Documentation ¶
Index ¶
- func ColumnsWithout(cols []string, skip ...string) []string
- func Commit(ctx context.Context) error
- func Excluded(cols []string) []string
- func GenerateMigrationSQL(sfrom, sto *schema.Schema) ([]string, error)
- func HasTx(ctx context.Context) bool
- func ReplaceQuery(d Columner, idCols ...string) string
- func Replacers(cnt int) string
- func Rollback(ctx context.Context) error
- func SchemaFromPostgresDB(db *sql.DB) (*schema.Schema, error)
- func SchemaFromPostgresWithConnect(dsn string) (*schema.Schema, error)
- func SchemaFromYAML(r io.Reader) (*schema.Schema, error)
- func SchemaToPlantUML(s *schema.Schema, w io.Writer, distance int) error
- func SchemaToYAML(s *schema.Schema, w io.Writer) error
- func SqlxDbFromContext(ctx context.Context) *sqlx.DB
- func SqlxTxFromContext(ctx context.Context) *sqlx.Tx
- func WithSqlxDb(ctx context.Context, d *sqlx.DB) context.Context
- func WithSqlxTx(ctx context.Context, tx *sqlx.Tx) context.Context
- func WithTx(ctx context.Context, f func(context.Context) error) error
- type Columner
- type CtxSqlxDb
- type CtxSqlxTx
- type ModelSet
- type ObjectField
- type ObjectModel
- func (m *ObjectModel[T]) Field(dbName string) objectField
- func (m *ObjectModel[T]) New() *T
- func (m *ObjectModel[T]) SchemaTable() *schema.Table
- func (m *ObjectModel[T]) WithComment(c string) *ObjectModel[T]
- func (m *ObjectModel[T]) WithConstraint(ctrs ...*schema.Constraint) *ObjectModel[T]
- func (m *ObjectModel[T]) WithDef(def string) *ObjectModel[T]
- func (m *ObjectModel[T]) WithIndex(idxs ...*schema.Index) *ObjectModel[T]
- func (m *ObjectModel[T]) WithType(t string) *ObjectModel[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColumnsWithout ¶ added in v1.0.6
func GenerateMigrationSQL ¶
GenerateMigrationSQL generates an array of SQL DDL queries for postgres that modify database tables, columns, indexes, etc.
func ReplaceQuery ¶ added in v1.0.6
func SchemaFromPostgresDB ¶
SchemaFromPostgresDB reads database schema from postgres *sql.DB
func SchemaFromPostgresWithConnect ¶ added in v1.0.2
SchemaFromPostgresDB reads database schema from postgres *sql.DB
func SchemaFromYAML ¶
SchemaFromYAML loads the schema from the yaml file
func SchemaToPlantUML ¶ added in v1.0.2
SchemaToPlantUML saves the schema to a puml file, distance - maximum path length for relationships between plantuml objects
func SchemaToYAML ¶
SchemaToYAML saves the schema to a yaml file
Types ¶
type ModelSet ¶ added in v1.0.7
type ModelSet struct {
// contains filtered or unexported fields
}
func NewModelSet ¶ added in v1.0.7
func NewModelSet(mds ...objectModel) *ModelSet
type ObjectField ¶ added in v1.0.7
type ObjectField[T any] struct { // contains filtered or unexported fields }
func FieldVirtual ¶ added in v1.0.7
func FieldVirtual[T any](dbName string) *ObjectField[T]
func (*ObjectField[T]) Column ¶ added in v1.0.7
func (f *ObjectField[T]) Column() *schema.Column
type ObjectModel ¶ added in v1.0.7
type ObjectModel[T any] struct { // contains filtered or unexported fields }
func Model ¶ added in v1.0.7
func Model[T any](table string, fields ...objectField) *ObjectModel[T]
func (*ObjectModel[T]) Field ¶ added in v1.0.7
func (m *ObjectModel[T]) Field(dbName string) objectField
func (*ObjectModel[T]) New ¶ added in v1.0.7
func (m *ObjectModel[T]) New() *T
func (*ObjectModel[T]) SchemaTable ¶ added in v1.0.7
func (m *ObjectModel[T]) SchemaTable() *schema.Table
func (*ObjectModel[T]) WithComment ¶ added in v1.0.7
func (m *ObjectModel[T]) WithComment(c string) *ObjectModel[T]
func (*ObjectModel[T]) WithConstraint ¶ added in v1.0.7
func (m *ObjectModel[T]) WithConstraint(ctrs ...*schema.Constraint) *ObjectModel[T]
func (*ObjectModel[T]) WithDef ¶ added in v1.0.7
func (m *ObjectModel[T]) WithDef(def string) *ObjectModel[T]
func (*ObjectModel[T]) WithIndex ¶ added in v1.0.7
func (m *ObjectModel[T]) WithIndex(idxs ...*schema.Index) *ObjectModel[T]
func (*ObjectModel[T]) WithType ¶ added in v1.0.7
func (m *ObjectModel[T]) WithType(t string) *ObjectModel[T]
Source Files ¶
Click to show internal directories.
Click to hide internal directories.