Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NoteMeta = drel.ModelMeta[Note]{ Table: "notes", Columns: []string{"id", "slug", "title", "category", "pinned", "created_at", "updated_at"}, PKColumns: []string{"id"}, Scan: scanNote, Snapshot: snapshotNote, Diff: diffNote, PKValue: notePKValue, InsertColumns: noteInsertColumns, ScanReturning: noteScanReturning, ColumnValue: noteColumnValue, NormalizeKey: noteNormalizeKey, }
View Source
var Notes = struct { ID drel.OrderedColumn[int] Slug drel.StringColumn Title drel.StringColumn Category drel.StringColumn Pinned drel.BoolColumn CreatedAt drel.TimeColumn UpdatedAt drel.TimeColumn }{ ID: drel.NewOrderedCol[int]("id"), Slug: drel.NewStringCol("slug"), Title: drel.NewStringCol("title"), Category: drel.NewStringCol("category"), Pinned: drel.NewBoolCol("pinned"), CreatedAt: drel.NewTimeCol("created_at"), UpdatedAt: drel.NewTimeCol("updated_at"), }
Functions ¶
This section is empty.
Types ¶
type Note ¶
type Note struct {
drel.Model[int]
Slug string `db:"slug,unique"`
Title string `db:"title"`
Category string `db:"category,index"`
Pinned bool `db:"pinned"`
}
Note is a simple SQLite-backed model. The db tag options declare an index on `category` and a unique index on `slug`, which codegen turns into CREATE INDEX DDL in the generated migration.
type NoteRepository ¶
type NoteRepository struct {
*drel.Repository[Note]
}
type TxNoteRepository ¶
type TxNoteRepository struct {
*drel.TxRepository[Note]
}
Click to show internal directories.
Click to hide internal directories.