Documentation
¶
Overview ¶
Package post holds typed column descriptors and relation descriptors for the Post model.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ID = base.ID AuthorID = base.AuthorID Title = base.Title Embedding = base.Embedding CreatedAt = base.CreatedAt )
View Source
var Author = momo.Relation[models.Post, models.Author]{ Name: "Author", Kind: momo.BelongsTo, Parent: momo.TableRef{Name: "posts"}, Child: momo.TableRef{Name: "authors"}, ParentMeta: (*models.Post)(nil).MomoMeta(), ChildMeta: (*models.Author)(nil).MomoMeta(), ParentCols: []string{"author_id"}, ChildCols: []string{"id"}, ChildPK: []string{"id"}, ParentKey: func(p *models.Post) ([]any, bool) { return []any{p.AuthorID}, true }, ChildKey: func(c *models.Author) ([]any, bool) { return []any{c.ID}, true }, SetParentKey: func(p *models.Post, k []any) { p.AuthorID = k[0].(int64) }, GetOne: func(p *models.Post) *models.Author { return p.Author }, SetOne: func(p *models.Post, c *models.Author) { p.Author = c }, }
Author is the belongs_to relation of Post.
View Source
var Table = momo.TableRef{Name: "posts"}
Table is the base table reference.
Functions ¶
func ColumnByName ¶
ColumnByName returns the typed column for an allowlisted external name. Names are matched exactly against database column names; relation fields and sensitive fields are not in the allowlist.
func ColumnNames ¶
func ColumnNames() []string
ColumnNames lists the allowlisted names in declaration order.
Types ¶
Click to show internal directories.
Click to hide internal directories.