posts

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PostMeta = drel.ModelMeta[Post]{
	Table:         "posts",
	Columns:       []string{"id", "title", "author_id", "created_at", "updated_at"},
	PKColumns:     []string{"id"},
	Scan:          scanPost,
	Snapshot:      snapshotPost,
	Diff:          diffPost,
	PKValue:       postPKValue,
	InsertColumns: postInsertColumns,
	ScanReturning: postScanReturning,
	ColumnValue:   postColumnValue,
	NormalizeKey:  postNormalizeKey,
}
View Source
var Posts = struct {
	ID        drel.OrderedColumn[int]
	Title     drel.StringColumn
	AuthorID  drel.OrderedColumn[int]
	CreatedAt drel.TimeColumn
	UpdatedAt drel.TimeColumn
}{
	ID:        drel.NewOrderedCol[int]("id"),
	Title:     drel.NewStringCol("title"),
	AuthorID:  drel.NewOrderedCol[int]("author_id"),
	CreatedAt: drel.NewTimeCol("created_at"),
	UpdatedAt: drel.NewTimeCol("updated_at"),
}

Functions

This section is empty.

Types

type Post

type Post struct {
	drel.Model[int]
	Title    string `db:"title"`
	AuthorID int    `db:"author_id"`
}

Post is owned by the posts slice. Deleting features/posts removes the model, the generated code and the migrations of this feature together.

type PostRepository

type PostRepository struct {
	*drel.Repository[Post]
}

func (*PostRepository) FindByID

func (r *PostRepository) FindByID(ctx context.Context, id int) (*Post, error)

type TxPostRepository

type TxPostRepository struct {
	*drel.TxRepository[Post]
}

func (*TxPostRepository) FindByID

func (r *TxPostRepository) FindByID(ctx context.Context, id int) (*Post, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL