edgedb 强大的对象关系数据库
edgedb 是一个强大的对象关系数据库,构建在pg 之上。
包含的特性:
- 严格的强类型模式;
- 强大而富有表现力的查询语言;
- 丰富的标准库;
- 内置支持模式迁移;
- 本机GraphQL支持。
数据模型
从表现上,类似graphql 的type 定义,如下:
type User {
required property name -> str;
}
type Person {
required property first_name -> str;
required property last_name -> str;
}
type Review {
required property body -> str;
required property rating -> int64 {
constraint min_value(0);
constraint max_value(5);
}
required link author -> User;
required link movie -> Movie;
required property creation_time -> local_datetime;
}
type Movie {
required property title -> str;
required property year -> int64;
required property description -> str;
multi link directors -> Person;
multi link cast -> Person;
property avg_rating := math::mean(.<movie[IS Review].rating);
}
edgeql
类似sql,但是很强大
SELECT User {
id,
name,
image,
latest_reviews := (
WITH UserReviews := User.<author
SELECT UserReviews {
id,
body,
rating,
movie: {
id,
title,
avg_rating,
}
}
ORDER BY .creation_time DESC
LIMIT 10
)
}
FILTER .id = <uuid>$id
graphql 支持
需要进行开启
CONFIGURE SYSTEM INSERT Port {
protocol := "graphql+http",
database := "tutorial",
address := "127.0.0.1",
port := 8888,
user := "http",
concurrency := 4,
};
查询方法:
{
Movie {
title
year
}
}
参考资料
https://edgedb.com/blog/edgedb-1-0-alpha-1/
https://github.com/edgedb/edgedb
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2018-04-12 elixir grpc 试用
2018-04-12 elixir 调用erlang 代码
2018-04-12 Elixir's keyword lists as option parameters
2015-04-12 BigPipe 了解