Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // WithGlobalUniqueID sets the universal ids options to the migration. // If this option is enabled, ent migration will allocate a 1<<32 range // for the ids of each entity (table). // Note that this option cannot be applied on tables that already exist. WithGlobalUniqueID = schema.WithGlobalUniqueID // WithDropColumn sets the drop column option to the migration. // If this option is enabled, ent migration will drop old columns // that were used for both fields and edges. This defaults to false. WithDropColumn = schema.WithDropColumn // WithDropIndex sets the drop index option to the migration. // If this option is enabled, ent migration will drop old indexes // that were defined in the schema. This defaults to false. // Note that unique constraints are defined using `UNIQUE INDEX`, // and therefore, it's recommended to enable this option to get more // flexibility in the schema changes. WithDropIndex = schema.WithDropIndex // WithForeignKeys enables creating foreign-key in schema DDL. This defaults to true. WithForeignKeys = schema.WithForeignKeys )
View Source
var ( // NodesColumns holds the columns for the "nodes" table. NodesColumns = []*schema.Column{ {Name: "hash", Type: field.TypeString, Unique: true}, {Name: "bucket", Type: field.TypeJSON, Nullable: true}, {Name: "type", Type: field.TypeString, Nullable: true}, {Name: "role", Type: field.TypeString, Nullable: true}, {Name: "content", Type: field.TypeJSON, Nullable: true}, {Name: "model", Type: field.TypeString, Nullable: true}, {Name: "provider", Type: field.TypeString, Nullable: true}, {Name: "agent_name", Type: field.TypeString, Nullable: true}, {Name: "stop_reason", Type: field.TypeString, Nullable: true}, {Name: "prompt_tokens", Type: field.TypeInt, Nullable: true}, {Name: "completion_tokens", Type: field.TypeInt, Nullable: true}, {Name: "total_tokens", Type: field.TypeInt, Nullable: true}, {Name: "cache_creation_input_tokens", Type: field.TypeInt, Nullable: true}, {Name: "cache_read_input_tokens", Type: field.TypeInt, Nullable: true}, {Name: "total_duration_ns", Type: field.TypeInt64, Nullable: true}, {Name: "prompt_duration_ns", Type: field.TypeInt64, Nullable: true}, {Name: "project", Type: field.TypeString, Nullable: true}, {Name: "created_at", Type: field.TypeTime, Default: "CURRENT_TIMESTAMP"}, {Name: "parent_hash", Type: field.TypeString, Nullable: true}, } // NodesTable holds the schema information for the "nodes" table. NodesTable = &schema.Table{ Name: "nodes", Columns: NodesColumns, PrimaryKey: []*schema.Column{NodesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { Symbol: "nodes_nodes_parent", Columns: []*schema.Column{NodesColumns[18]}, RefColumns: []*schema.Column{NodesColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { Name: "node_parent_hash", Unique: false, Columns: []*schema.Column{NodesColumns[18]}, }, { Name: "node_role", Unique: false, Columns: []*schema.Column{NodesColumns[3]}, }, { Name: "node_model", Unique: false, Columns: []*schema.Column{NodesColumns[5]}, }, { Name: "node_provider", Unique: false, Columns: []*schema.Column{NodesColumns[6]}, }, { Name: "node_agent_name", Unique: false, Columns: []*schema.Column{NodesColumns[7]}, }, { Name: "node_role_model", Unique: false, Columns: []*schema.Column{NodesColumns[3], NodesColumns[5]}, }, { Name: "node_project", Unique: false, Columns: []*schema.Column{NodesColumns[16]}, }, { Name: "node_created_at", Unique: false, Columns: []*schema.Column{NodesColumns[17]}, }, }, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ NodesTable, } )
Functions ¶
Types ¶
type Schema ¶
type Schema struct {
// contains filtered or unexported fields
}
Schema is the API for creating, migrating and dropping a schema.
Click to show internal directories.
Click to hide internal directories.