schema

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DbTag     = "db"
	SkipField = "-"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OptionSetterFn

type OptionSetterFn func(*options)

func As

func As(as string) OptionSetterFn

As set table alias to schema, will be use as reference if set

func AuditFields

func AuditFields(enabled bool) OptionSetterFn

AuditFields enable/disable audit fields for schema

func AutoIncrement

func AutoIncrement(ai bool) OptionSetterFn

AutoIncrement set auto increment options that will affect insert query generator

func Columns

func Columns(cols ...string) OptionSetterFn

Columns set columns in a schema

func CreatedAtColumn

func CreatedAtColumn(col string) OptionSetterFn

CreatedAtColumn set custom column name for created_at (default: "created_at")

func CreatedByColumn

func CreatedByColumn(col string) OptionSetterFn

CreatedByColumn set custom column name for created_by (default: "created_by")

func FromModelRef

func FromModelRef(m interface{}) OptionSetterFn

FromModelRef reflect referenced model as Schema

func PrimaryKey

func PrimaryKey(pk string) OptionSetterFn

PrimaryKey set columns that will be primary key, otherwise it will use "id" column

func SoftDelete

func SoftDelete(enabled bool) OptionSetterFn

SoftDelete enable/disable soft delete for schema

func SoftDeleteColumn

func SoftDeleteColumn(col string) OptionSetterFn

SoftDeleteColumn set custom column name for soft delete (default: "deleted_at")

func TableName

func TableName(s string) OptionSetterFn

TableName set table name of schema

func UpdatedAtColumn

func UpdatedAtColumn(col string) OptionSetterFn

UpdatedAtColumn set custom column name for updated_at (default: "updated_at")

func UpdatedByColumn

func UpdatedByColumn(col string) OptionSetterFn

UpdatedByColumn set custom column name for updated_by (default: "updated_by")

type Reference

type Reference string

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

func New

func New(args ...OptionSetterFn) *Schema

func (*Schema) As

func (s *Schema) As() string

func (*Schema) AuditFields

func (s *Schema) AuditFields() bool

AuditFields returns whether audit fields are enabled for this schema

func (*Schema) AutoIncrement

func (s *Schema) AutoIncrement() bool

func (*Schema) Columns

func (s *Schema) Columns() []string

func (*Schema) CountColumns

func (s *Schema) CountColumns() int

func (*Schema) CreatedAtColumn

func (s *Schema) CreatedAtColumn() string

CreatedAtColumn returns the column name for created_at

func (*Schema) CreatedByColumn

func (s *Schema) CreatedByColumn() string

CreatedByColumn returns the column name for created_by

func (*Schema) Filter

func (s *Schema) Filter(column1 string, columnN ...string) []string

func (*Schema) InsertColumns

func (s *Schema) InsertColumns() []string

func (*Schema) IsColumnExist

func (s *Schema) IsColumnExist(col string) bool

func (*Schema) PrimaryKey

func (s *Schema) PrimaryKey() string

func (*Schema) Ref

func (s *Schema) Ref() Reference

func (*Schema) SoftDelete

func (s *Schema) SoftDelete() bool

SoftDelete returns whether soft delete is enabled for this schema

func (*Schema) SoftDeleteColumn

func (s *Schema) SoftDeleteColumn() string

SoftDeleteColumn returns the column name used for soft delete

func (*Schema) TableName

func (s *Schema) TableName() string

func (*Schema) UpdateColumns

func (s *Schema) UpdateColumns() []string

func (*Schema) UpdatedAtColumn

func (s *Schema) UpdatedAtColumn() string

UpdatedAtColumn returns the column name for updated_at

func (*Schema) UpdatedByColumn

func (s *Schema) UpdatedByColumn() string

UpdatedByColumn returns the column name for updated_by

Jump to

Keyboard shortcuts

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