Documentation
¶
Overview ¶
Package example is the reference schema for momo: a multi-tenant document store with comments, tags and a pgvector embedding. Copy it as a starting point. Run `go generate ./...` after changing a model; `momo generate --check` fails CI when the committed output is stale.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comment ¶
type Comment struct {
momo.Model `momo:"table:comments"`
ID int64 `momo:"pk,identity"`
DocumentID int64 `momo:"index"`
Body string
}
Comment is a remark on a document.
type Document ¶
type Document struct {
momo.Model `momo:"table:documents"`
ID int64 `momo:"pk,identity"`
TenantID int64 `momo:"column:tenant_id,notnull,index"`
Title string `momo:"size:300,notnull"`
Body string `momo:"type:text"`
Embedding vector.Vector `momo:"dim:1536"`
Status string `momo:"column:status,enum:document_status,default:'draft'"`
CreatedAt time.Time `momo:"column:created_at,read_only,default:now()"`
Comments []Comment `momo:"has_many,fk:DocumentID"`
Tags []Tag `momo:"many2many,join:document_tags"`
Tenant *Tenant `momo:"belongs_to,fk:TenantID"`
}
Document is a tenant's document with a semantic-search embedding.
func (*Document) MomoConfig ¶
MomoConfig declares what struct tags cannot express: the hnsw index with its operator class (hnsw has no default), the status enum, a check and a comment. The generator reads it statically; it never runs.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package comment holds typed column descriptors and relation descriptors for the Comment model.
|
Package comment holds typed column descriptors and relation descriptors for the Comment model. |
|
Package document holds typed column descriptors and relation descriptors for the Document model.
|
Package document holds typed column descriptors and relation descriptors for the Document model. |
|
Package tag holds typed column descriptors and relation descriptors for the Tag model.
|
Package tag holds typed column descriptors and relation descriptors for the Tag model. |
|
Package tenant holds typed column descriptors and relation descriptors for the Tenant model.
|
Package tenant holds typed column descriptors and relation descriptors for the Tenant model. |
Click to show internal directories.
Click to hide internal directories.