Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Memberships = schema.Define("memberships", func(t *MembershipsTable) { t.UserID = t.BigInt("user_id").NotNull() t.OrgID = t.BigInt("org_id").NotNull() t.Role = t.Text("role").NotNull() t.Active = t.Boolean("active").NotNull().Default(true) t.PrimaryKey("memberships_pkey").On(t.UserID, t.OrgID) t.Unique("memberships_org_role_key").On(t.OrgID, t.Role) t.Check("memberships_role_check", t.Role.In("owner", "member")) t.ForeignKey("memberships_user_fk").On(t.UserID).References(Users.ID).OnDelete(schema.ForeignKeyActionCascade) t.Index("memberships_role_idx").On(t.Role, t.OrgID.Desc()) })
View Source
var Posts = schema.Define("posts", func(t *PostsTable) { t.ID = t.BigSerial("id").PrimaryKey() t.UserID = t.BigInt("user_id").NotNull().References(Users.ID) t.Title = t.Text("title").NotNull() t.Body = t.Text("body").NotNull() t.Index("posts_user_id_idx").On(t.UserID) })
View Source
var Users = schema.Define("users", func(t *UsersTable) { t.ID = t.BigSerial("id").PrimaryKey() t.Email = t.VarChar("email", 255).NotNull().Unique() t.Name = t.Text("name").NotNull() t.Active = t.Boolean("active").NotNull().Default(true) t.CreatedAt = t.TimestampTZ("created_at").NotNull().DefaultNow() t.Index("users_email_key").On(t.Email) t.UniqueIndex("users_active_email_idx").On(t.Active, t.Email.Desc()) })
Functions ¶
func ManagedTables ¶
func ManagedTables() []schema.TableReference
ManagedTables exposes the example schema registry used by the CLI.
Types ¶
type MembershipsTable ¶
type PostsTable ¶
Click to show internal directories.
Click to hide internal directories.