agnesoft/agdb_api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

agnesoft/agdb_api

Composer 安装命令:

composer require agnesoft/agdb_api

包简介

Agnesoft Graph Database API client for PHP

README 文档

README

agdb logo

agdb

The graph database.

db       api       studio       server       cloud

rust ts js js python java c cpp csharp

license Crates.io DeepWiki release coverage codecov

agdb logo  Agnesoft Graph Database

Quickstart Db | Quickstart Client | QUERIES | DECISION TREE

Why not SQL?

The Agnesoft Graph Database (aka agdb) is application native database without compromises. It is persistent, optionally memory mapped graph database with native object 'no-text' queries. It can be used as a main persistent storage, data analytics platform as well as fast in-memory cache. Its typed schema-less data store allows for flexible and seamless data updates with no downtime or costly migrations. All queries are constructed via a builder pattern or directly as objects with no special language or text parsing.

agdb logo  Key Features

  • The agdb is application native database.
  • No query language, queries are written in the same language as the application.
  • Performance without limits, constant time lookups and traversals regardless of db size.
  • Simple to build, use & scale.

Technical features:

  • Data plotted on a graph
  • Typed key-value properties attached to graph elements (nodes & edges)
  • Persistent platform agnostic file based storage (transferable between platforms)
  • ACID compliant
  • Object queries with builder pattern (no text, no query language)
  • Memory mapped for fast querying
  • Server mode
  • Cluster mode
  • In-built TLS support
  • OpenAPI clients in any programming language
  • Cloud hosted SaaS database
  • Db itself has no dependencies

agdb logo  At a glance [Db]

cargo add agdb

Basic usage demonstrating creating a database, inserting graph elements with data and querying them back with select and search. The function using this code must handle agdb::DbError for operator ? to work (i.e. fn foo() -> Result<(), agdb::DbError>):

use agdb::{Db, DbId, QueryBuilder, DbType};

let mut db = Db::new("db_file.agdb")?;

db.exec_mut(QueryBuilder::insert().nodes().aliases("users").query())?;

#[derive(Debug, DbType)]
struct User { db_id: Option<DbId>, name: String, }
let users = vec![User { db_id: None, name: "Alice".into(), },
                 User { db_id: None, name: "Bob".into(), },
                 User { db_id: None, name: "John".into(), }];

let users_ids = db.exec_mut(QueryBuilder::insert().nodes().values(&users).query())?;

db.exec_mut(
    QueryBuilder::insert()
        .edges()
        .from("users")
        .to(&users_ids)
        .query(),
)?;

This code creates a database called user_db.agdb with a simple graph of 4 nodes. The first node is aliased users and 3 user nodes for Alice, Bob and John are then connected with edges to the users node. The arbitrary name property is attached to the user nodes. Rather than inserting values directly with keys (which is also possible) we use our own type and derive from agdb::DbType to allow it to be used with the database.

You can select the graph elements (both nodes & edges) with their ids to get them back with their associated data (key-value properties). Let's select our users and convert the result into the list (notice we select only values relevant to our User type with passing User::db_keys()):

let users: Vec<User> = db
    .exec(
        QueryBuilder::select()
            .elements::<User>()
            .ids(&users_ids)
            .query(),
    )?
    .try_into()?;

println!("{:?}", users);
// [User { db_id: Some(DbId(2)), username: "Alice" },
//  User { db_id: Some(DbId(3)), username: "Bob" },
//  User { db_id: Some(DbId(4)), username: "John" }]

You can also search through the graph to get back only certain elements based on conditions. For example:

let user: User = db
    .exec(
        QueryBuilder::select()
            .elements::<User>()
            .search()
            .from("users")
            .where_()
            .key("name")
            .value("Bob")
            .query(),
    )?
    .try_into()?;

println!("{:?}", user);
// User { db_id: Some(DbId(3)), username: "Bob" }

For database concepts and primitive data types see concepts. For comprehensive overview of all queries see the queries reference or continue with more in-depth efficient agdb.

agdb logo  Crate Features

agdb

Feature Default Description
derive yes Enables derive macro to enable custom user types to be directly used with the database.
opeanapi no Enables ToSchema macro on query structs so they can be exported to json OpeanAPI/Swagger schema.
serde no Enables serialiation/deserialization of queries and QueryResult using serde.
api no Enables annotations on all structs to facilitate API generation for different languages.

agdb_api

Feature Default Description
tls no Enables rust-tls for reqwest.
api no Enables annotations on all structs to facilitate API generation for different languages.

agdb_server

Feature Default Description
tls no Enables TLS support via rustls. On Windows requires MSVC and CMake to build.
studio no Embedd the agdb_studio into the server at /studio route.

agdb logo  Decision Tree

flowchart TD;
    A[Embedded or server?] --> Embedded
    A --> B[Client or hosting?]
    Embedded --> Studio[<a href='https://agdb.agnesoft.com/docs/references/studio'>Studio</a>]
    Embedded --> Queries[<a href='https://agdb.agnesoft.com/docs/references/queries'>Queries</a>]
    B --> Client
    B --> Hosting
    Client --> API[<a href='https://agdb.agnesoft.com/api-docs/openapi'>API</a>]
    Client --> Studio
    Client --> Queries
    Hosting --> Server[<a href='https://agdb.agnesoft.com/docs/references/server'>Server</a>]
    Hosting --> Cloud[<a href='https://agdb.agnesoft.com/enterprise/cloud'>Cloud</a>]
Loading

agdb logo  Roadmap

The following are planned features:

Feature Description
Agdb Studio Graphical interface to agdb
Python Client Convenience client using bindings genereated from OpenAPI.
Java Client Convenience client using bindings genereated from OpenAPI.
C# Client Convenience client using bindings genereated from OpenAPI.
C Client Convenience client using bindings genereated from OpenAPI.
C++ Client Convenience client using bindings genereated from OpenAPI.
Agdb Playground Free public cloud-based playground to tinker with agdb.
#[no_std] The agdb does not require any dependencies and thus should be (in theory) no_std friendly but it will likely require some development & testing.
Public Cloud Offering Commercial & supported agdb instance hosted in a public cloud.

agdb logo  Reference

agnesoft/agdb_api 适用场景与选型建议

agnesoft/agdb_api 是一款 基于 Rust 开发的 Composer 扩展包,目前已累计 625 次下载、GitHub Stars 达 137, 最近一次更新时间为 2024 年 08 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「rest」 「api」 「sdk」 「openapi」 「openapitools」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 agnesoft/agdb_api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 agnesoft/agdb_api 我们能提供哪些服务?
定制开发 / 二次开发

基于 agnesoft/agdb_api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 625
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 137
  • 点击次数: 16
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 137
  • Watchers: 4
  • Forks: 7
  • 开发语言: Rust

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2024-08-11