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 ( // UserColumns holds the columns for the "user" table. UserColumns = []*schema.Column{ {Name: "id", Type: field.TypeUint, Increment: true}, {Name: "words", Type: field.TypeString, Nullable: true, Default: ""}, {Name: "network", Type: field.TypeString, Nullable: true, Default: ""}, {Name: "address", Type: field.TypeString, Nullable: true, Default: ""}, {Name: "private_key", Type: field.TypeString, Nullable: true, Default: ""}, {Name: "balance", Type: field.TypeOther, SchemaType: map[string]string{"mysql": "decimal(36,18)"}}, {Name: "balance_update_time", Type: field.TypeInt, Nullable: true, Default: 0}, {Name: "token_info", Type: field.TypeJSON, Nullable: true}, {Name: "create_time", Type: field.TypeInt, Nullable: true, Default: 0}, {Name: "create_date", Type: field.TypeTime, Nullable: true}, {Name: "is_transfer", Type: field.TypeInt8, Nullable: true, Default: 0}, {Name: "total_token_value", Type: field.TypeOther, SchemaType: map[string]string{"mysql": "decimal(36,18)"}}, {Name: "trx_mode", Type: field.TypeEnum, Nullable: true, Enums: []string{"transfer", "lock"}, Default: "transfer"}, {Name: "trx_addr_type", Type: field.TypeEnum, Nullable: true, Enums: []string{"single", "multi"}, Default: "single"}, {Name: "trx_priv_addr", Type: field.TypeString, Nullable: true, Default: ""}, {Name: "trx_priv_pkey", Type: field.TypeString, Nullable: true, Default: ""}, {Name: "aes_type", Type: field.TypeInt8, Nullable: true, Default: 1}, } // UserTable holds the schema information for the "user" table. UserTable = &schema.Table{ Name: "user", Columns: UserColumns, PrimaryKey: []*schema.Column{UserColumns[0]}, } // Tables holds all the tables in the schema. Tables = []*schema.Table{ UserTable, } )
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.