Database
Cedalio simplifies serverless GraphQL backend usage and deployment. It enables a fully configured GraphQL API generated automatically. Each deployment has a wallet owner that control the data access
The schema file defines the structure of your data, relationships, and configurations for validations and authentication using the GraphQL schema definition language.
Cedalio automatically generates a CRUD API for GraphQL types labeled with
@model
within the schema.graphql
file.You can create a model by applying the
@model
directive to any of your GraphQL types. Each model will have its own set of GraphQL queries and mutations.Schema
Generated Schema
type Post @model {
slug: String! @unique
title: String!
published: Boolean @default(value: false)
rating: Float
likes: Int
}
type Query {
post(by: PostByInput!): Post
postCollection(
after: String
before: String
first: Int
last: Int
): PostConnection
}
type Mutation {
postCreate(input: PostCreateInput!): PostCreatePayload
postDelete(by: PostByInput!): PostDeletePayload
postUpdate(by: PostByInput!, input: PostUpdateInput!): PostUpdatePayload
}
type Post {
createdAt: DateTime!
id: ID!
likes: Int
published: Boolean
rating: Float
slug: String!
title: String!
updatedAt: DateTime!
}
input PostByInput {
id: ID
slug: String
}
type PostConnection {
edges: [PostEdge]
pageInfo: PageInfo!
}
input PostCreateInput {
likes: Int
published: Boolean = false
rating: Float
slug: String!
title: String!
}
type PostCreatePayload {
post: Post
}
type PostDeletePayload {
deletedId: ID!
}
type PostEdge {
cursor: String!
node: Post!
}
type PageInfo {
endCursor: String
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
}
input PostUpdateInput {
likes: Int
published: Boolean
rating: Float
slug: String
title: String
}
type PostUpdatePayload {
post: Post
}
You can also create regular object types that can be embedded within your existing models.
Schema
Generated Schema
type Order @model {
billingAddress: Address
shippingAddress: Address
}
type Address {
line1: String!
line2: String
zip: String
phone: PhoneNumber
}
type Query {
order(by: OrderByInput!): Order
orderCollection(
after: String
before: String
first: Int
last: Int
): OrderConnection
}
type Mutation {
orderCreate(input: OrderCreateInput!): OrderCreatePayload
orderDelete(by: OrderByInput!): OrderDeletePayload
orderUpdate(by: OrderByInput!, input: OrderUpdateInput!): OrderUpdatePayload
}
type Order {
billingAddress: Address
createdAt: DateTime!
id: ID!
shippingAddress: Address
updatedAt: DateTime!
}
type Address {
line1: String!
line2: String
phone: PhoneNumber
zip: String
}
input AddressInput {
line1: String!
line2: String
phone: PhoneNumber
zip: String
}
input OrderByInput {
id: ID
}
type OrderConnection {
edges: [OrderEdge]
pageInfo: PageInfo!
}
input OrderCreateInput {
billingAddress: AddressInput
shippingAddress: AddressInput
}
type OrderCreatePayload {
order: Order
}
type OrderDeletePayload {
deletedId: ID!
}
type OrderEdge {
cursor: String!
node: Order!
}
type PageInfo {
endCursor: String
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
}
input OrderUpdateInput {
billingAddress: AddressInput
shippingAddress: AddressInput
}
type OrderUpdatePayload {
order: Order
}
Cedalio automatically manages system fields for any
@model
type.Models consist of customizable fields, similar to columns in a database table, which can be of any supported scalar type.
Cedalio currently does not support
Interface
or Union
types.Last modified 4mo ago