EdgeDB 基于 PostgreSQL 的对象关系数据库 项目简介
EdgeDB 是一个基于 PostgreSQL 的对象关系数据库,其目标是使用户能够以更少的工作量构建安全、高效的软件。特性:严格、强类型数据库模式(schema) 强大而富有表现力的查询语言 丰富的标准库 内置支持 schema 迁移 原生 GraphQL 支持EdgeDB 数据库模型示例: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);
}EdgeDB 使用 EdgeQL 查询语言,格式如下: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
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);
}EdgeDB 使用 EdgeQL 查询语言,格式如下: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