Documentation ¶
Index ¶
- Constants
- func DeleteShard(ctx context.Context, id string) error
- func EnsureModelSchema(ctx context.Context, md *ModelDesc) error
- func Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func Field[T Storable, F any](ctx context.Context, modelItem T, defval F, fieldName string) (F, error)
- func Field2SQLColumn(f FieldDescription) (modelcols.SQLColumn, modelcols.SQLIndexes, error)
- func Get[T any](ctx context.Context, query string, dest *T, args ...interface{}) error
- func GetBuffer() *bytes.Buffer
- func GetByID[T Storable](ctx context.Context, dest *T, id interface{}) error
- func IdentifyPanic() string
- func In(query string, args ...interface{}) (string, []interface{}, error)
- func IndexEqualDBIndex(tname string, idx modelcols.SQLIndex, dbidx DBIndexDef) bool
- func IndexesEqualToDBIndexes(sqs *modelcols.SQLModel, dbidxs DBIndexDefs) bool
- func InitDB(c DatabaseDSN) (*sqlx.DB, error)
- func IsJsonView(v interface{}) bool
- func IsLoggingQuery(ctx context.Context) bool
- func IsSimpleProtocol(ctx context.Context) bool
- func PutBuffer(b *bytes.Buffer)
- func Query(ctx context.Context, query string, args ...interface{}) (*sqlx.Rows, error)
- func Rebind(query string) string
- func Register[T ModelDescriber](sh Shard, m T) error
- func Replace[T Storable](ctx context.Context, modelItem T, skipFields ...string) error
- func SQLAllowNull(ft reflect.Type) bool
- func SQLAlterModel(ctx context.Context, md *ModelDesc, mddbidxs DBIndexDefs, ...) error
- func SQLAlterTable(schema, tname string, last, to *modelcols.SQLModel, dbcolinfos []DBColInfo, ...) []string
- func SQLAlterView(schema, tname string, last, to *modelcols.SQLModel, dbidxs DBIndexDefs) []string
- func SQLCreateModelWithColumns(ctx context.Context, md *ModelDesc, sqs *modelcols.SQLModel) error
- func SQLCreateTableWithColumns(pt *PatchTable, sqs *modelcols.SQLModel)
- func SQLCreateView(pt *PatchView, sqs *modelcols.SQLModel)
- func SQLDefaultValue(ft reflect.Type) string
- func SQLType(ft reflect.Type, ln, prec int) string
- func Select[T any](ctx context.Context, query string, dest *[]T, args ...interface{}) error
- func SelectCursorWalk[T any](ctx context.Context, cursorName, selectQuery string, destSlice *[]T, ...) error
- func SelectShard(ctx context.Context, id string) (context.Context, error)
- func ToSnakeCase2(str string) string
- func UniqAdd[T comparable](sl []T, av T) []T
- func WalkShards(ctx context.Context, f func(Shard) error) error
- func WithLoggingQuery(ctx context.Context) context.Context
- func WithShard(ctx context.Context, s Shard) context.Context
- func WithShards(ctx context.Context, s *Shards) context.Context
- func WithSimpleProtocol(ctx context.Context) context.Context
- func WithTx(ctx context.Context, f func(context.Context) error) error
- func WithTxInShard(ctx context.Context, shardId string, f func(context.Context) error) error
- type AnyObjectMap
- func (f AnyObjectMap) ConvertTo(value interface{}) error
- func (f AnyObjectMap) MarshalJSON() ([]byte, error)
- func (u AnyObjectMap) PostgresAllowNull() bool
- func (AnyObjectMap) PostgresDefaultValue() string
- func (AnyObjectMap) PostgresType() string
- func (f *AnyObjectMap) Scan(value interface{}) error
- func (f AnyObjectMap) String() string
- func (f *AnyObjectMap) UnmarshalJSON(b []byte) error
- func (f AnyObjectMap) Value() (driver.Value, error)
- type AppUUID
- type AppXID
- type BigSerial
- func (n *BigSerial) ConvertFrom(v interface{}) error
- func (n BigSerial) MarshalJSON() ([]byte, error)
- func (u BigSerial) PostgresAllowNull() bool
- func (BigSerial) PostgresDefaultValue() string
- func (BigSerial) PostgresType() string
- func (n *BigSerial) Scan(value interface{}) error
- func (n *BigSerial) UnmarshalJSON(b []byte) error
- func (n BigSerial) Value() (driver.Value, error)
- type Bool
- func (n Bool) Bool() bool
- func (b *Bool) ConvertFrom(v interface{}) error
- func (n Bool) MarshalJSON() ([]byte, error)
- func (Bool) PostgresAllowNull() bool
- func (Bool) PostgresDefaultValue() string
- func (Bool) PostgresType() string
- func (n *Bool) Scan(value interface{}) error
- func (n *Bool) SetBool(b bool)
- func (n *Bool) UnmarshalJSON(b []byte) error
- func (n Bool) Value() (driver.Value, error)
- type CtxShard
- type CtxShards
- type DBColInfo
- type DBIndexDef
- type DBIndexDefs
- type DatabaseDSN
- type DbConfig
- type DbConfigTable
- type Decimal
- func Float64ToDecimal(v float64) Decimal
- func NegOne() Decimal
- func NewDecimalFromAny(v interface{}) (*Decimal, error)
- func NewDecimalFromFloat64(x float64) Decimal
- func NewDecimalFromInt(x int) Decimal
- func NewDecimalFromInt64(x int64) Decimal
- func NewDecimalFromUint64(x uint64) Decimal
- func One() Decimal
- func Zero() Decimal
- func (x Decimal) Add(d2 Decimal) Decimal
- func (x Decimal) Bool() bool
- func (d *Decimal) ConvertFrom(v interface{}) error
- func (x Decimal) Div(d2 Decimal) Decimal
- func (x Decimal) Equal(d2 Decimal) bool
- func (x Decimal) Float() float64
- func (d Decimal) GetNumber() (*decimal.Big, error)
- func (x Decimal) Int() int64
- func (x Decimal) Less(d2 Decimal) bool
- func (x Decimal) LessOrEqual(d2 Decimal) bool
- func (d Decimal) MarshalJSON() ([]byte, error)
- func (d Decimal) MarshalText() ([]byte, error)
- func (x Decimal) Mod(d2 Decimal) Decimal
- func (x Decimal) Mul(d2 Decimal) Decimal
- func (x Decimal) Negative() Decimal
- func (x *Decimal) ParseGoType(v interface{})
- func (u Decimal) PostgresAllowNull() bool
- func (Decimal) PostgresDefaultValue() string
- func (Decimal) PostgresTypeWithLenPrec(ln, prec int) string
- func (x Decimal) Pow(d2 Decimal) Decimal
- func (x Decimal) RoundHalfUp() int64
- func (x Decimal) RoundHalfUpTo2Sign() Decimal
- func (x Decimal) RoundTo(n int, m decimal.RoundingMode) Decimal
- func (d *Decimal) Scan(value interface{}) error
- func (d *Decimal) SetNumber(dd *decimal.Big)
- func (d Decimal) String() string
- func (x Decimal) Sub(d2 Decimal) Decimal
- func (x Decimal) Uint() uint64
- func (d *Decimal) UnmarshalJSON(b []byte) error
- func (d *Decimal) UnmarshalText(data []byte) error
- func (d Decimal) Value() (driver.Value, error)
- type Decimal152
- type Decimal153
- type Decimal192
- type ErrorNoTransaction
- type ErrorNotFound
- type FD
- type FieldDescriber
- type FieldDescription
- type Float64
- func (f *Float64) ConvertFrom(v interface{}) error
- func (n Float64) Float64() float64
- func (n Float64) MarshalJSON() ([]byte, error)
- func (Float64) PostgresAllowNull() bool
- func (Float64) PostgresDefaultValue() string
- func (Float64) PostgresType() string
- func (n *Float64) Scan(value interface{}) error
- func (n *Float64) SetFloat64(f float64)
- func (n *Float64) UnmarshalJSON(b []byte) error
- func (n Float64) Value() (driver.Value, error)
- type Int64
- func (f *Int64) ConvertFrom(v interface{}) error
- func (n Int64) Int() int
- func (n Int64) MarshalJSON() ([]byte, error)
- func (Int64) PostgresAllowNull() bool
- func (Int64) PostgresDefaultValue() string
- func (Int64) PostgresType() string
- func (n *Int64) Scan(value interface{}) error
- func (n *Int64) SetInt(i int)
- func (n *Int64) UnmarshalJSON(b []byte) error
- func (n Int64) Value() (driver.Value, error)
- type JsonB
- func (n *JsonB) ConvertFrom(v interface{}) error
- func (n JsonB) ConvertTo(value interface{}) error
- func (n JsonB) MarshalJSON() ([]byte, error)
- func (u JsonB) PostgresAllowNull() bool
- func (JsonB) PostgresDefaultValue() string
- func (JsonB) PostgresType() string
- func (n *JsonB) Scan(value interface{}) error
- func (n *JsonB) UnmarshalJSON(b []byte) error
- func (n JsonB) Value() (driver.Value, error)
- type JsonErr
- type JsonView
- func (mo *JsonView[T]) IsFilled(structFieldNames ...string) bool
- func (mo *JsonView[T]) IsFullFilled() bool
- func (mo *JsonView[T]) MarshalJSON() ([]byte, error)
- func (jv *JsonView[T]) SQLView() *SQLView[T]
- func (mo *JsonView[T]) Scan(value interface{}) error
- func (mo *JsonView[T]) SetFilled(structFieldNames ...string) error
- func (mo *JsonView[T]) SetFullFilled()
- func (mo *JsonView[T]) SetUnfilled(structFieldNames ...string) error
- func (mo *JsonView[T]) UnmarshalJSON(b []byte) error
- func (mo *JsonView[T]) Valid() bool
- func (mo *JsonView[T]) Value() (driver.Value, error)
- type JsonViewErr
- type JsonViewErrer
- type JsonViewer
- type MD
- type MaterializedViewable
- type Mdjs
- type MdjsField
- type MigrationProcessor
- type MigrationRegistrator
- type Model
- type Model58
- type ModelDesc
- func (md ModelDesc) ColumnByFieldName(fieldName string) (*FieldDescription, error)
- func (md ModelDesc) ColumnByJsonName(jsonName string) (*FieldDescription, error)
- func (md ModelDesc) ColumnByStoreName(storeName string) (*FieldDescription, error)
- func (md *ModelDesc) ColumnPtr(i int) *FieldDescription
- func (md *ModelDesc) ColumnPtrsCount() int
- func (md ModelDesc) ColumnsByFieldNames(fieldNames ...string) (res []*FieldDescription)
- func (md ModelDesc) CreateElemPtr() interface{}
- func (md ModelDesc) CreateSlicePtr() interface{}
- func (md *ModelDesc) CreatedAtField() *FieldDescription
- func (md *ModelDesc) DeletedAtField() *FieldDescription
- func (md *ModelDesc) IdField() *FieldDescription
- func (md ModelDesc) IsMaterialized() bool
- func (md ModelDesc) IsView() bool
- func (md ModelDesc) ModelType() reflect.Type
- func (md *ModelDesc) ReplaceEntries(schema string) ([]string, map[string]ReplaceEntry, error)
- func (md ModelDesc) StoreName() string
- func (md ModelDesc) UniqName() string
- func (md *ModelDesc) UpdatedAtField() *FieldDescription
- func (md ModelDesc) ViewQuery(ctx context.Context, sr *PgStore) (string, error)
- func (md *ModelDesc) WalkColumnPtrs(f func(i int, v *FieldDescription) error) error
- type ModelDescriber
- type ModelObject
- type ModelQueryEngine
- type NullBool
- func (n *NullBool) ConvertFrom(v interface{}) error
- func (n NullBool) MarshalJSON() ([]byte, error)
- func (u NullBool) PostgresAllowNull() bool
- func (NullBool) PostgresDefaultValue() string
- func (NullBool) PostgresType() string
- func (n *NullBool) Scan(value interface{}) error
- func (n *NullBool) UnmarshalJSON(b []byte) error
- func (n NullBool) Value() (driver.Value, error)
- type NullDecimal
- func (d *NullDecimal) ConvertFrom(v interface{}) error
- func (n NullDecimal) MarshalJSON() ([]byte, error)
- func (u NullDecimal) PostgresAllowNull() bool
- func (NullDecimal) PostgresDefaultValue() string
- func (NullDecimal) PostgresTypeWithLenPrec(ln, prec int) string
- func (n *NullDecimal) Scan(value interface{}) error
- func (n *NullDecimal) UnmarshalJSON(b []byte) error
- func (n NullDecimal) Value() (driver.Value, error)
- type NullDecimal152
- type NullDecimal153
- type NullDecimal192
- type NullFloat64
- func (n *NullFloat64) ConvertFrom(v interface{}) error
- func (n NullFloat64) MarshalJSON() ([]byte, error)
- func (u NullFloat64) PostgresAllowNull() bool
- func (NullFloat64) PostgresDefaultValue() string
- func (NullFloat64) PostgresType() string
- func (n *NullFloat64) Scan(value interface{}) error
- func (n *NullFloat64) UnmarshalJSON(b []byte) error
- func (n NullFloat64) Value() (driver.Value, error)
- type NullInt64
- func (n *NullInt64) ConvertFrom(v interface{}) error
- func (n NullInt64) MarshalJSON() ([]byte, error)
- func (u NullInt64) PostgresAllowNull() bool
- func (NullInt64) PostgresDefaultValue() string
- func (NullInt64) PostgresType() string
- func (n *NullInt64) Scan(value interface{}) error
- func (n *NullInt64) UnmarshalJSON(b []byte) error
- func (n NullInt64) Value() (driver.Value, error)
- type NullJsonB
- func (n *NullJsonB) ConvertFrom(v interface{}) error
- func (n NullJsonB) ConvertTo(value interface{}) error
- func (n NullJsonB) MarshalJSON() ([]byte, error)
- func (u NullJsonB) PostgresAllowNull() bool
- func (NullJsonB) PostgresDefaultValue() string
- func (NullJsonB) PostgresType() string
- func (n *NullJsonB) Scan(value interface{}) error
- func (n *NullJsonB) UnmarshalJSON(b []byte) error
- func (n NullJsonB) Value() (driver.Value, error)
- type NullString
- func (n *NullString) ConvertFrom(v interface{}) error
- func (n NullString) MarshalJSON() ([]byte, error)
- func (u NullString) PostgresAllowNull() bool
- func (NullString) PostgresDefaultValue() string
- func (NullString) PostgresType() string
- func (n *NullString) Scan(value interface{}) error
- func (n *NullString) UnmarshalJSON(b []byte) error
- func (n NullString) Value() (driver.Value, error)
- type NullText
- func (n *NullText) ConvertFrom(v interface{}) error
- func (n NullText) MarshalJSON() ([]byte, error)
- func (u NullText) PostgresAllowNull() bool
- func (NullText) PostgresDefaultValue() string
- func (NullText) PostgresType() string
- func (n *NullText) Scan(value interface{}) error
- func (n *NullText) UnmarshalJSON(b []byte) error
- func (n NullText) Value() (driver.Value, error)
- type NullTime
- func (t *NullTime) ConvertFrom(v interface{}) error
- func (n NullTime) MarshalJSON() ([]byte, error)
- func (u NullTime) PostgresAllowNull() bool
- func (u NullTime) PostgresDefaultValue() string
- func (u NullTime) PostgresType() string
- func (nt *NullTime) Scan(value interface{}) (err error)
- func (nt NullTime) String() string
- func (n *NullTime) UnmarshalJSON(b []byte) error
- func (nt NullTime) Value() (driver.Value, error)
- type PatchAddColumn
- type PatchAlterColumnDefVal
- type PatchAlterColumnNullable
- type PatchAlterColumnType
- type PatchCreateIndex
- type PatchCreateTable
- type PatchCreateView
- type PatchDropIndex
- type PatchDropView
- type PatchTable
- func (pt *PatchTable) AddColumnPatch(cp fmt.Stringer)
- func (pt *PatchTable) AddCreateIndexPatch(cp fmt.Stringer)
- func (pt *PatchTable) AddCreateTablePatch(cp fmt.Stringer)
- func (pt *PatchTable) AddDropIndexPatch(cp fmt.Stringer)
- func (pt *PatchTable) AddUpdateNullsPatch(cp fmt.Stringer)
- func (pt PatchTable) Queries() []string
- type PatchUpdateNulls
- type PatchView
- type PgSelect
- type PgStore
- func (sr PgStore) Begin(ctx context.Context) (*PgStore, error)
- func (sr *PgStore) CheckStarted(ctx context.Context, stx *PgStore, schema, migrname string) (bool, error)
- func (sr *PgStore) Close()
- func (sr PgStore) Commit() error
- func (sr *PgStore) DbConfigTableFromModel(ctx context.Context, md *ModelDesc) (*DbConfigTable, error)
- func (sr *PgStore) Field(modelItem Storable, fieldName string) (interface{}, error)
- func (sr *PgStore) MD2SQLModel(ctx context.Context, md *ModelDesc) (*modelcols.SQLModel, error)
- func (sr *PgStore) Migrate(ctx context.Context, mProcessor MigrationProcessor) error
- func (sr *PgStore) ModelObjectFrom(modelItem Storable) (ModelObject, error)
- func (sr *PgStore) PrepExec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (sr *PgStore) PrepGet(ctx context.Context, query string, dest interface{}, args ...interface{}) error
- func (sr *PgStore) PrepQueryx(ctx context.Context, query string, args ...interface{}) (*sqlx.Rows, error)
- func (sr *PgStore) PrepSelect(ctx context.Context, query string, dest interface{}, args ...interface{}) error
- func (sr *PgStore) PrepSelectCursorWalk(ctx context.Context, cursorName, selectQuery string, destSlice interface{}, ...) error
- func (sr *PgStore) PrepareQuery(ctx context.Context, query string) (string, error)
- func (sr *PgStore) Replace(ctx context.Context, modelItem Storable, skipFields ...string) error
- func (sr PgStore) Rollback() error
- func (sr *PgStore) SaveModelConfig(ctx context.Context, md *ModelDesc) error
- func (sr PgStore) Schema() string
- func (s *PgStore) Select(ctx context.Context) *PgSelect
- func (sr *PgStore) SetUnsafe()
- func (sr *PgStore) Start(ctx context.Context, stx *PgStore, schema, migrname string) error
- func (sr *PgStore) Stop(ctx context.Context, stx *PgStore, schema, migrname string) error
- func (sr PgStore) String() string
- func (sr PgStore) Tx() *sqlx.Tx
- func (sr PgStore) WithBeginTx(ctx context.Context, f func(storeCopy *PgStore) error) (err error)
- func (sr PgStore) WithTx(ctx context.Context, f func(storeCopy *PgStore) error) (err error)
- type PostgresDefaultValuer
- type PostgresNullable
- type PostgresTyper
- type PostgresTyperLn
- type PostgresTyperLnPrec
- type ReplaceEntry
- type RowScanner
- type RowsGenerator
- type SQLView
- func (mo *SQLView[T]) Columns() []string
- func (mo *SQLView[T]) IsFilled(structFieldNames ...string) bool
- func (mo *SQLView[T]) IsFullFilled() bool
- func (sv *SQLView[T]) JsonView() *JsonView[T]
- func (mo *SQLView[T]) Scan(rows sqlx.ColScanner, prefix string) error
- func (mo *SQLView[T]) SetFilled(structFieldNames ...string) error
- func (mo *SQLView[T]) SetFullFilled()
- func (mo *SQLView[T]) SetUnfilled(structFieldNames ...string) error
- func (mo *SQLView[T]) Valid() bool
- func (mo *SQLView[T]) Values() []interface{}
- type SQLViewErr
- type SQLViewErrer
- type SQLViewer
- type Scanner
- type Shard
- type Shards
- func (shs *Shards) AnalyzeAndReplaceQuery(sr *PgStore, query string) (string, map[string]ReplaceEntry, error)
- func (s *Shards) DeleteShard(id string)
- func (s *Shards) SetShard(id string, db *sqlx.DB, schema string) Shard
- func (s *Shards) ShardByID(id string) (Shard, bool)
- func (s *Shards) Walk(f func(Shard) error) error
- type SomeUUID
- type SomeXID
- type Storable
- type Store
- func (s *Store) Close()
- func (s Store) GetModelDescription(model Storable) (*ModelDesc, bool)
- func (s Store) GetModelDescriptionByType(typ reflect.Type) (*ModelDesc, bool)
- func (s *Store) Init()
- func (sr *Store) JSONBuildObjectSQL(md *ModelDesc, prefix string, onlyStructFieldNames ...string) string
- func (s Store) ModelDescriptions() map[reflect.Type]*ModelDesc
- func (s Store) QueryReplacers() map[sqlPattern]map[string]ReplaceEntry
- type String
- func (s *String) ConvertFrom(v interface{}) error
- func (n String) MarshalJSON() ([]byte, error)
- func (String) PostgresAllowNull() bool
- func (String) PostgresDefaultValue() string
- func (String) PostgresType() string
- func (n *String) Scan(value interface{}) error
- func (n *String) SetString(s string)
- func (n String) String() string
- func (n *String) UnmarshalJSON(b []byte) error
- func (n String) Value() (driver.Value, error)
- type StringArray
- func (f StringArray) MarshalJSON() ([]byte, error)
- func (u StringArray) PostgresAllowNull() bool
- func (StringArray) PostgresDefaultValue() string
- func (StringArray) PostgresType() string
- func (f *StringArray) Scan(value interface{}) error
- func (f *StringArray) UnmarshalJSON(b []byte) error
- func (f StringArray) Value() (driver.Value, error)
- type Text
- type Time
- func (t Time) AssignTo(v reflect.Value)
- func (t *Time) ConvertFrom(v interface{}) error
- func (t Time) FormatRus(f string) string
- func (t *Time) GobDecode(data []byte) error
- func (t Time) GobEncode() ([]byte, error)
- func (t Time) MarshalBinary() ([]byte, error)
- func (t Time) MarshalJSON() ([]byte, error)
- func (u Time) PostgresAllowNull() bool
- func (u Time) PostgresDefaultValue() string
- func (u Time) PostgresType() string
- func (t Time) Round(d time.Duration) Time
- func (t *Time) Scan(value interface{}) (err error)
- func (t Time) String() string
- func (t Time) Time() time.Time
- func (t *Time) UnmarshalBinary(data []byte) error
- func (t *Time) UnmarshalJSON(b []byte) error
- func (t Time) Value() (driver.Value, error)
- type TraceUUID
- type TraceXID
- type UUID
- func (u *UUID[T]) ConvertFrom(v interface{}) error
- func (u UUID[T]) IsZero() bool
- func (u UUID[T]) MarshalJSON() ([]byte, error)
- func (UUID[T]) PostgresAllowNull() bool
- func (UUID[T]) PostgresDefaultValue() string
- func (UUID[T]) PostgresType() string
- func (u *UUID[T]) Scan(src interface{}) error
- func (id UUID[T]) String() string
- func (u *UUID[T]) UnmarshalJSON(b []byte) error
- func (u UUID[T]) Value() (driver.Value, error)
- type UUID58
- func (u *UUID58) ConvertFrom(v interface{}) error
- func (u *UUID58) GobDecode(data []byte) error
- func (u UUID58) GobEncode() ([]byte, error)
- func (u UUID58) IsZero() bool
- func (u UUID58) MarshalJSON() ([]byte, error)
- func (UUID58) PostgresAllowNull() bool
- func (UUID58) PostgresDefaultValue() string
- func (UUID58) PostgresType() string
- func (u *UUID58) Scan(src interface{}) error
- func (u UUID58) String() string
- func (u *UUID58) UnmarshalJSON(b []byte) error
- func (u UUID58) Value() (driver.Value, error)
- type UUIDJsonTyped
- type UUIDType
- type UUIDv4
- func (u *UUIDv4) ConvertFrom(v interface{}) error
- func (u *UUIDv4) GobDecode(data []byte) error
- func (u UUIDv4) GobEncode() ([]byte, error)
- func (u UUIDv4) IsZero() bool
- func (u UUIDv4) MarshalJSON() ([]byte, error)
- func (UUIDv4) PostgresAllowNull() bool
- func (UUIDv4) PostgresDefaultValue() string
- func (UUIDv4) PostgresType() string
- func (u *UUIDv4) Scan(src interface{}) error
- func (u UUIDv4) String() string
- func (u *UUIDv4) UnmarshalJSON(b []byte) error
- func (u UUIDv4) Value() (driver.Value, error)
- type UUIDv4Array
- func (a UUIDv4Array) MarshalJSON() ([]byte, error)
- func (UUIDv4Array) PostgresAllowNull() bool
- func (UUIDv4Array) PostgresDefaultValue() string
- func (UUIDv4Array) PostgresType() string
- func (a *UUIDv4Array) Raw() []UUIDv4
- func (a *UUIDv4Array) Scan(value interface{}) error
- func (a *UUIDv4Array) UnmarshalJSON(b []byte) error
- func (a UUIDv4Array) Value() (driver.Value, error)
- type Uint64Array
- func (f Uint64Array) MarshalJSON() ([]byte, error)
- func (u Uint64Array) PostgresAllowNull() bool
- func (Uint64Array) PostgresDefaultValue() string
- func (Uint64Array) PostgresType() string
- func (f *Uint64Array) Scan(value interface{}) error
- func (f *Uint64Array) UnmarshalJSON(b []byte) error
- func (f Uint64Array) Value() (driver.Value, error)
- type UniqueObjects
- func (uo *UniqueObjects) AddObject(data ModelObject) error
- func (uo *UniqueObjects) Close()
- func (uo *UniqueObjects) CopyObjects() (res []ModelObject)
- func (uo *UniqueObjects) Object(id interface{}) (ModelObject, bool)
- func (uo *UniqueObjects) Objects() []ModelObject
- func (uo *UniqueObjects) Reset()
- type Valuer
- type Viewable
- type XID
- func (u XID[T]) MarshalJSON() ([]byte, error)
- func (XID[T]) PostgresAllowNull() bool
- func (XID[T]) PostgresDefaultValue() string
- func (XID[T]) PostgresType() string
- func (u *XID[T]) Scan(src interface{}) error
- func (id XID[T]) String() string
- func (u *XID[T]) UnmarshalJSON(b []byte) error
- func (u XID[T]) Value() (driver.Value, error)
- type XIDJsonTyped
- type XIDType
Constants ¶
const ( TagSql = "sql" TagStore = "store" TagKey = "key" TagGinKey = "ginkey" TagLen = "len" TagDBName = "db" TagPrec = "prec" TagDefVal = "defval" TagFullText = "fulltext" TagUniqueKey = "unikey" TagPK = "pk" // `pk:""` - поле входит в первичный ключ, актуально только для новых таблиц IDField = "ID" CreatedAtField = "CreatedAt" UpdatedAtField = "UpdatedAt" DeletedAtField = "DeletedAt" )
const BrowserDateFormat = `"2006-01-02"`
date
const BrowserDateTimeFormat = `"2006-01-02T15:04"`
datetime-local
const (
DriverPostgreSQL = "pgx"
)
const ISOTimeFormat = `"2006-01-02T15:04:05.999Z07:00"`
Date()
const SQL_ColumnsInfo = `` /* 191-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func Field ¶ added in v1.0.1
func Field[T Storable, F any](ctx context.Context, modelItem T, defval F, fieldName string) (F, error)
get field value by struct field name defval must be Model{}.Field
func Field2SQLColumn ¶
func Field2SQLColumn(f FieldDescription) (modelcols.SQLColumn, modelcols.SQLIndexes, error)
func IdentifyPanic ¶ added in v1.0.9
func IdentifyPanic() string
func In ¶
In expands slice values in args, returning the modified query string and a new arg list that can be executed by a database. The `query` should use the `?` or `$n` bindVar. The return value uses the `?` bindVar.
func IndexEqualDBIndex ¶
func IndexEqualDBIndex(tname string, idx modelcols.SQLIndex, dbidx DBIndexDef) bool
func IndexesEqualToDBIndexes ¶
func IndexesEqualToDBIndexes(sqs *modelcols.SQLModel, dbidxs DBIndexDefs) bool
func IsJsonView ¶ added in v1.0.12
func IsJsonView(v interface{}) bool
func IsLoggingQuery ¶
func IsSimpleProtocol ¶
func Rebind ¶
Rebind a query from the default bindtype (QUESTION) to the target bindtype. Escaping: ?? translate to ?
func Register ¶
func Register[T ModelDescriber](sh Shard, m T) error
func SQLAllowNull ¶ added in v1.0.3
func SQLAlterModel ¶
func SQLAlterTable ¶
func SQLAlterView ¶ added in v1.1.1
func SQLAlterView(schema, tname string, last, to *modelcols.SQLModel, dbidxs DBIndexDefs) []string
func SQLCreateTableWithColumns ¶
func SQLCreateTableWithColumns(pt *PatchTable, sqs *modelcols.SQLModel)
func SQLCreateView ¶ added in v1.1.1
func SQLDefaultValue ¶ added in v1.0.2
func SelectCursorWalk ¶
func ToSnakeCase2 ¶
func UniqAdd ¶ added in v1.0.1
func UniqAdd[T comparable](sl []T, av T) []T
Types ¶
type AnyObjectMap ¶
type AnyObjectMap map[string]interface{}
func (AnyObjectMap) ConvertTo ¶
func (f AnyObjectMap) ConvertTo(value interface{}) error
func (AnyObjectMap) MarshalJSON ¶
func (f AnyObjectMap) MarshalJSON() ([]byte, error)
func (AnyObjectMap) PostgresAllowNull ¶ added in v1.0.3
func (u AnyObjectMap) PostgresAllowNull() bool
func (AnyObjectMap) PostgresDefaultValue ¶ added in v1.0.2
func (AnyObjectMap) PostgresDefaultValue() string
func (AnyObjectMap) PostgresType ¶ added in v1.0.2
func (AnyObjectMap) PostgresType() string
func (*AnyObjectMap) Scan ¶
func (f *AnyObjectMap) Scan(value interface{}) error
func (AnyObjectMap) String ¶
func (f AnyObjectMap) String() string
func (*AnyObjectMap) UnmarshalJSON ¶
func (f *AnyObjectMap) UnmarshalJSON(b []byte) error
type BigSerial ¶
func (*BigSerial) ConvertFrom ¶
store.Converter interface, n must contain zero value before call
func (BigSerial) MarshalJSON ¶
func (BigSerial) PostgresAllowNull ¶ added in v1.0.3
func (BigSerial) PostgresDefaultValue ¶ added in v1.0.2
func (BigSerial) PostgresType ¶ added in v1.0.2
func (*BigSerial) UnmarshalJSON ¶
type Bool ¶
type Bool bool
func (*Bool) ConvertFrom ¶
store.Converter interface, n must contain zero value before call
func (Bool) MarshalJSON ¶ added in v1.0.2
func (Bool) PostgresAllowNull ¶ added in v1.0.3
func (Bool) PostgresDefaultValue ¶ added in v1.0.2
func (Bool) PostgresType ¶ added in v1.0.2
func (*Bool) UnmarshalJSON ¶ added in v1.0.2
type DBColInfo ¶
type DBIndexDef ¶
type DBIndexDef struct { Name string `db:"indname"` Table string `db:"tablename"` Schema string `db:"nspname"` Fields StringArray `db:"indkey_names"` }
func (DBIndexDef) String ¶
func (d DBIndexDef) String() string
type DBIndexDefs ¶
type DBIndexDefs []DBIndexDef
func CurrentSchemaIndexes ¶
func CurrentSchemaIndexes(ctx context.Context, tablename string) (DBIndexDefs, error)
func (DBIndexDefs) FindByName ¶
func (idxs DBIndexDefs) FindByName(n string) (DBIndexDef, bool)
type DatabaseDSN ¶
type DbConfigTable ¶
type DbConfigTable struct { TableName string `db:"table_name"` Storej *modelcols.SQLModel `db:"storej"` }
func (*DbConfigTable) IsEmpty ¶
func (c *DbConfigTable) IsEmpty() bool
type Decimal ¶
type Decimal []byte
func Float64ToDecimal ¶
func NewDecimalFromAny ¶
func NewDecimalFromFloat64 ¶
func NewDecimalFromInt ¶
func NewDecimalFromInt64 ¶
func NewDecimalFromUint64 ¶
func (*Decimal) ConvertFrom ¶
store.Converter interface, d must contain zero value before call
func (Decimal) LessOrEqual ¶
func (Decimal) MarshalJSON ¶
func (Decimal) MarshalText ¶
func (*Decimal) ParseGoType ¶
func (x *Decimal) ParseGoType(v interface{})
func (Decimal) PostgresAllowNull ¶ added in v1.0.3
func (Decimal) PostgresDefaultValue ¶ added in v1.0.2
func (Decimal) PostgresTypeWithLenPrec ¶ added in v1.0.3
func (Decimal) RoundHalfUpTo2Sign ¶
два знака после запятой 0.00
func (*Decimal) UnmarshalJSON ¶
func (*Decimal) UnmarshalText ¶
type Decimal152 ¶ added in v1.0.2
type Decimal152 Decimal
func (Decimal152) PostgresType ¶ added in v1.0.2
func (Decimal152) PostgresType() string
type Decimal153 ¶ added in v1.0.2
type Decimal153 Decimal
func (Decimal153) PostgresType ¶ added in v1.0.2
func (Decimal153) PostgresType() string
type Decimal192 ¶ added in v1.0.2
type Decimal192 Decimal
func (Decimal192) PostgresType ¶ added in v1.0.2
func (Decimal192) PostgresType() string
type ErrorNoTransaction ¶
type ErrorNoTransaction struct{}
Ошибка транзакции
func (ErrorNoTransaction) Error ¶
func (e ErrorNoTransaction) Error() string
type ErrorNotFound ¶
Ошибка "не найден"
type FD ¶ added in v1.0.2
type FD[T Valuer, PT Scanner[T]] struct { V T Valid bool // contains filtered or unexported fields }
func NewFD ¶ added in v1.0.2
func NewFD[T Valuer, PT Scanner[T]](structField reflect.StructField) *FD[T, PT]
func (*FD[T, PT]) FD ¶ added in v1.0.2
func (fdt *FD[T, PT]) FD() *FieldDescription
func (FD[T, PT]) MarshalJSON ¶ added in v1.0.2
func (FD[T, PT]) PostgresType ¶ added in v1.0.2
func (*FD[T, PT]) UnmarshalJSON ¶ added in v1.0.2
type FieldDescriber ¶ added in v1.0.2
type FieldDescriber interface {
FD() *FieldDescription
}
type FieldDescription ¶
type FieldDescription struct { Idx int // индекс в слайсе ModelDescription.Columns StructField reflect.StructField // поле с базовыми характеристиками поля структуры ElemType reflect.Type // тип элемента, который характеризует структура Name string // store name (имя в хранилище) JsonName string Ln int Prec int SQLTypeDef string DefVal string Indexes []string GinIndexes []string UniqIndexes []string Nullable bool Skip bool SkipReplace bool // игнорится только при реплейсе FullTextEnabled bool PK bool JsonSkip bool JsonOmitEmpty bool }
FieldDescription - универсальная структура, используемая во многих моделях и структурах.
func NewFieldDescription ¶
func NewFieldDescription(structField reflect.StructField) *FieldDescription
func (*FieldDescription) IsStored ¶
func (fd *FieldDescription) IsStored() bool
Говорит о том, сохраняется ли текущее поле в хранилище или нет
func (*FieldDescription) MarshalJSON ¶
func (fd *FieldDescription) MarshalJSON() ([]byte, error)
func (*FieldDescription) MarshalText ¶
func (fd *FieldDescription) MarshalText() (text []byte, err error)
func (FieldDescription) String ¶
func (fd FieldDescription) String() string
Вывод FieldDescription в виде сткроки
type Float64 ¶
type Float64 float64
func (*Float64) ConvertFrom ¶
store.Converter interface, n must contain zero value before call
func (Float64) MarshalJSON ¶ added in v1.0.2
func (Float64) PostgresAllowNull ¶ added in v1.0.3
func (Float64) PostgresDefaultValue ¶ added in v1.0.2
func (Float64) PostgresType ¶ added in v1.0.2
func (*Float64) SetFloat64 ¶ added in v1.0.2
func (*Float64) UnmarshalJSON ¶ added in v1.0.2
type Int64 ¶
type Int64 int64
func (*Int64) ConvertFrom ¶
store.Converter interface, n must contain zero value before call
func (Int64) MarshalJSON ¶ added in v1.0.2
func (Int64) PostgresAllowNull ¶ added in v1.0.3
func (Int64) PostgresDefaultValue ¶ added in v1.0.2
func (Int64) PostgresType ¶ added in v1.0.2
func (*Int64) UnmarshalJSON ¶ added in v1.0.2
type JsonB ¶
type JsonB struct { // Val содержит указатель на значение // После анмаршала (из базы/json) тип его всегда становится map[string]interface{} или другим, как указано в описании к json.Unmarshal // вне зависимости от того, что там было до этого Val interface{} }
func (*JsonB) ConvertFrom ¶
store.Converter interface, n must contain zero value before call
func (JsonB) MarshalJSON ¶
func (JsonB) PostgresAllowNull ¶ added in v1.0.3
func (JsonB) PostgresDefaultValue ¶ added in v1.0.2
func (JsonB) PostgresType ¶ added in v1.0.2
func (*JsonB) UnmarshalJSON ¶
type JsonView ¶ added in v1.0.2
type JsonView[T Storable] struct { V T MD *ModelDesc Filled []*FieldDescription }
func NewJsonView ¶ added in v1.0.2
func (*JsonView[T]) IsFullFilled ¶ added in v1.0.2
func (*JsonView[T]) MarshalJSON ¶ added in v1.0.2
func (*JsonView[T]) SetFullFilled ¶ added in v1.0.2
func (mo *JsonView[T]) SetFullFilled()
func (*JsonView[T]) SetUnfilled ¶ added in v1.0.2
func (*JsonView[T]) UnmarshalJSON ¶ added in v1.0.2
type JsonViewErr ¶ added in v1.0.5
func (JsonViewErr[T]) MarshalJSON ¶ added in v1.0.7
func (v JsonViewErr[T]) MarshalJSON() ([]byte, error)
func (JsonViewErr[T]) SQLView ¶ added in v1.0.5
func (v JsonViewErr[T]) SQLView() SQLViewErr[T]
func (*JsonViewErr[T]) UnmarshalJSON ¶ added in v1.0.7
func (v *JsonViewErr[T]) UnmarshalJSON(b []byte) error
type JsonViewErrer ¶ added in v1.0.8
type JsonViewErrer[T Storable] interface { JsonView() JsonViewErr[T] }
type JsonViewer ¶ added in v1.0.6
type MaterializedViewable ¶ added in v1.1.1
type MaterializedViewable interface { Viewable MaterializedView() // not called, define with empty body }
MaterializedViewable is an interface that the materialized view-model structure must implement
type Mdjs ¶
type MdjsField ¶
type MdjsField struct { Name string `json:"name"` DBName string `json:"dbname"` Type reflect.Type `json:"-"` Desc *FieldDescription `json:"-"` }
type MigrationProcessor ¶
type MigrationProcessor interface { AfterCreateNewSchemaTable(ctx context.Context, stx *PgStore, md *ModelDesc, schema string) error AfterAlterModelError(ctx context.Context, err error, stx *PgStore, md *ModelDesc, sqsdb, sqsmd *modelcols.SQLModel, schema string) error AfterMigrate(ctx context.Context, stx *PgStore, reg MigrationRegistrator, sqsdb, sqsmd *modelcols.SQLModel, schema string) error AfterCommit(ctx context.Context, stx *PgStore) error }
type MigrationRegistrator ¶
type Model ¶ added in v1.0.10
type Model struct { ID UUIDv4 `json:"id"` CreatedAt Time `json:"createdAt"` UpdatedAt Time `json:"updatedAt"` DeletedAt NullTime `json:"-" key:"deleted_at_idx"` }
func (*Model) MarkUpdated ¶ added in v1.0.10
func (m *Model) MarkUpdated()
type Model58 ¶ added in v1.0.10
type Model58 struct { ID UUID58 `json:"id"` CreatedAt Time `json:"createdAt"` UpdatedAt Time `json:"updatedAt"` DeletedAt NullTime `json:"-" key:"deleted_at_idx"` }
func (*Model58) MarkUpdated ¶ added in v1.0.10
func (m *Model58) MarkUpdated()
type ModelDesc ¶
type ModelDesc struct {
// contains filtered or unexported fields
}
func NewModelDescription ¶
func (ModelDesc) ColumnByFieldName ¶
func (md ModelDesc) ColumnByFieldName(fieldName string) (*FieldDescription, error)
GetColumnByFieldName - get fd by struct field name
func (ModelDesc) ColumnByJsonName ¶
func (md ModelDesc) ColumnByJsonName(jsonName string) (*FieldDescription, error)
func (ModelDesc) ColumnByStoreName ¶ added in v1.0.2
func (md ModelDesc) ColumnByStoreName(storeName string) (*FieldDescription, error)
func (*ModelDesc) ColumnPtr ¶
func (md *ModelDesc) ColumnPtr(i int) *FieldDescription
func (*ModelDesc) ColumnPtrsCount ¶
func (ModelDesc) ColumnsByFieldNames ¶
func (md ModelDesc) ColumnsByFieldNames(fieldNames ...string) (res []*FieldDescription)
GetColumnsByFieldNames - get fd's by struct field name
func (ModelDesc) CreateElemPtr ¶ added in v1.0.1
func (md ModelDesc) CreateElemPtr() interface{}
func (ModelDesc) CreateSlicePtr ¶
func (md ModelDesc) CreateSlicePtr() interface{}
func (*ModelDesc) CreatedAtField ¶
func (md *ModelDesc) CreatedAtField() *FieldDescription
func (*ModelDesc) DeletedAtField ¶
func (md *ModelDesc) DeletedAtField() *FieldDescription
func (*ModelDesc) IdField ¶
func (md *ModelDesc) IdField() *FieldDescription
func (ModelDesc) IsMaterialized ¶ added in v1.1.1
func (*ModelDesc) ReplaceEntries ¶
ReplaceEntries создает map[Old]New - замены текста в запросе для нужной модели
func (*ModelDesc) UpdatedAtField ¶
func (md *ModelDesc) UpdatedAtField() *FieldDescription
func (*ModelDesc) WalkColumnPtrs ¶
func (md *ModelDesc) WalkColumnPtrs(f func(i int, v *FieldDescription) error) error
type ModelDescriber ¶ added in v1.0.2
type ModelObject ¶ added in v1.0.1
type ModelObject struct {
// contains filtered or unexported fields
}
func ModelObjectFrom ¶ added in v1.0.1
func ModelObjectFrom[T Storable](ctx context.Context, modelItem T) (ModelObject, error)
type ModelQueryEngine ¶ added in v1.0.9
type ModelQueryEngine[T Storable, R RowsGenerator] struct { // contains filtered or unexported fields }
func (*ModelQueryEngine[T, R]) ResponseList ¶ added in v1.0.9
func (q *ModelQueryEngine[T, R]) ResponseList(rowsGen R) ([]JsonViewer[T], error)
type NullBool ¶
func (*NullBool) ConvertFrom ¶
store.Converter interface, n must contain zero value before call
func (NullBool) MarshalJSON ¶
func (NullBool) PostgresAllowNull ¶ added in v1.0.3
func (NullBool) PostgresDefaultValue ¶ added in v1.0.2
func (NullBool) PostgresType ¶ added in v1.0.2
func (*NullBool) UnmarshalJSON ¶
type NullDecimal ¶
Nullable decimal, length 19 precision 6
func (*NullDecimal) ConvertFrom ¶
func (d *NullDecimal) ConvertFrom(v interface{}) error
func (NullDecimal) MarshalJSON ¶
func (n NullDecimal) MarshalJSON() ([]byte, error)
func (NullDecimal) PostgresAllowNull ¶ added in v1.0.3
func (u NullDecimal) PostgresAllowNull() bool
func (NullDecimal) PostgresDefaultValue ¶ added in v1.0.2
func (NullDecimal) PostgresDefaultValue() string
func (NullDecimal) PostgresTypeWithLenPrec ¶ added in v1.0.3
func (NullDecimal) PostgresTypeWithLenPrec(ln, prec int) string
func (*NullDecimal) Scan ¶
func (n *NullDecimal) Scan(value interface{}) error
Scan implements the Scanner interface.
func (*NullDecimal) UnmarshalJSON ¶
func (n *NullDecimal) UnmarshalJSON(b []byte) error
type NullDecimal152 ¶ added in v1.0.2
type NullDecimal152 NullDecimal
func (NullDecimal152) PostgresType ¶ added in v1.0.2
func (NullDecimal152) PostgresType() string
type NullDecimal153 ¶ added in v1.0.2
type NullDecimal153 NullDecimal
func (NullDecimal153) PostgresType ¶ added in v1.0.2
func (NullDecimal153) PostgresType() string
type NullDecimal192 ¶ added in v1.0.2
type NullDecimal192 NullDecimal
func (NullDecimal192) PostgresType ¶ added in v1.0.2
func (NullDecimal192) PostgresType() string
type NullFloat64 ¶
type NullFloat64 sql.NullFloat64
func (*NullFloat64) ConvertFrom ¶
func (n *NullFloat64) ConvertFrom(v interface{}) error
store.Converter interface, n must contain zero value before call
func (NullFloat64) MarshalJSON ¶
func (n NullFloat64) MarshalJSON() ([]byte, error)
func (NullFloat64) PostgresAllowNull ¶ added in v1.0.3
func (u NullFloat64) PostgresAllowNull() bool
func (NullFloat64) PostgresDefaultValue ¶ added in v1.0.2
func (NullFloat64) PostgresDefaultValue() string
func (NullFloat64) PostgresType ¶ added in v1.0.2
func (NullFloat64) PostgresType() string
func (*NullFloat64) Scan ¶
func (n *NullFloat64) Scan(value interface{}) error
func (*NullFloat64) UnmarshalJSON ¶
func (n *NullFloat64) UnmarshalJSON(b []byte) error
type NullInt64 ¶
func (*NullInt64) ConvertFrom ¶
store.Converter interface, n must contain zero value before call
func (NullInt64) MarshalJSON ¶
func (NullInt64) PostgresAllowNull ¶ added in v1.0.3
func (NullInt64) PostgresDefaultValue ¶ added in v1.0.2
func (NullInt64) PostgresType ¶ added in v1.0.2
func (*NullInt64) UnmarshalJSON ¶
type NullJsonB ¶
type NullJsonB struct { // Val содержит указатель на значение // После анмаршала (из базы/json) тип его всегда становится map[string]interface{} или другим, как указано в описании к json.Unmarshal // вне зависимости от того, что там было до этого Val interface{} Valid bool // Valid is true if Time is not NULL }
func NewNullJsonB ¶
func NewNullJsonB(val interface{}) *NullJsonB
func (*NullJsonB) ConvertFrom ¶
func (NullJsonB) MarshalJSON ¶
func (NullJsonB) PostgresAllowNull ¶ added in v1.0.3
func (NullJsonB) PostgresDefaultValue ¶ added in v1.0.2
func (NullJsonB) PostgresType ¶ added in v1.0.2
func (*NullJsonB) UnmarshalJSON ¶
type NullString ¶
type NullString sql.NullString
func (*NullString) ConvertFrom ¶
func (n *NullString) ConvertFrom(v interface{}) error
store.Converter interface, n must contain zero value before call
func (NullString) MarshalJSON ¶
func (n NullString) MarshalJSON() ([]byte, error)
func (NullString) PostgresAllowNull ¶ added in v1.0.3
func (u NullString) PostgresAllowNull() bool
func (NullString) PostgresDefaultValue ¶ added in v1.0.2
func (NullString) PostgresDefaultValue() string
func (NullString) PostgresType ¶ added in v1.0.2
func (NullString) PostgresType() string
func (*NullString) Scan ¶
func (n *NullString) Scan(value interface{}) error
func (*NullString) UnmarshalJSON ¶
func (n *NullString) UnmarshalJSON(b []byte) error
type NullText ¶
type NullText sql.NullString
func (*NullText) ConvertFrom ¶
store.Converter interface, n must contain zero value before call
func (NullText) MarshalJSON ¶
func (NullText) PostgresAllowNull ¶ added in v1.0.3
func (NullText) PostgresDefaultValue ¶ added in v1.0.2
func (NullText) PostgresType ¶ added in v1.0.2
func (*NullText) UnmarshalJSON ¶
type NullTime ¶
func (*NullTime) ConvertFrom ¶
store.Converter interface, t must contain zero value before call
func (NullTime) MarshalJSON ¶
func (NullTime) PostgresAllowNull ¶ added in v1.0.3
func (NullTime) PostgresDefaultValue ¶ added in v1.0.2
func (NullTime) PostgresType ¶ added in v1.0.2
func (*NullTime) UnmarshalJSON ¶
type PatchAddColumn ¶
func (PatchAddColumn) String ¶
func (c PatchAddColumn) String() string
type PatchAlterColumnDefVal ¶
func (PatchAlterColumnDefVal) String ¶
func (c PatchAlterColumnDefVal) String() string
type PatchAlterColumnNullable ¶
func (PatchAlterColumnNullable) String ¶
func (c PatchAlterColumnNullable) String() string
type PatchAlterColumnType ¶
func (PatchAlterColumnType) String ¶
func (c PatchAlterColumnType) String() string
type PatchCreateIndex ¶
func (PatchCreateIndex) String ¶
func (c PatchCreateIndex) String() string
type PatchCreateTable ¶
type PatchCreateTable struct { Schema string Table string Cols modelcols.SQLColumns }
func (PatchCreateTable) String ¶
func (c PatchCreateTable) String() string
type PatchCreateView ¶ added in v1.1.1
func (PatchCreateView) String ¶ added in v1.1.1
func (c PatchCreateView) String() string
type PatchDropIndex ¶
func (PatchDropIndex) String ¶
func (c PatchDropIndex) String() string
type PatchDropView ¶ added in v1.1.1
func (PatchDropView) String ¶ added in v1.1.1
func (c PatchDropView) String() string
type PatchTable ¶
type PatchTable struct { Schema string Name string DropIndexes []fmt.Stringer UpdateNulls []fmt.Stringer AlterCols []fmt.Stringer CreateTables []fmt.Stringer CreateIndexes []fmt.Stringer }
func (*PatchTable) AddColumnPatch ¶
func (pt *PatchTable) AddColumnPatch(cp fmt.Stringer)
func (*PatchTable) AddCreateIndexPatch ¶
func (pt *PatchTable) AddCreateIndexPatch(cp fmt.Stringer)
func (*PatchTable) AddCreateTablePatch ¶
func (pt *PatchTable) AddCreateTablePatch(cp fmt.Stringer)
func (*PatchTable) AddDropIndexPatch ¶
func (pt *PatchTable) AddDropIndexPatch(cp fmt.Stringer)
func (*PatchTable) AddUpdateNullsPatch ¶
func (pt *PatchTable) AddUpdateNullsPatch(cp fmt.Stringer)
func (PatchTable) Queries ¶
func (pt PatchTable) Queries() []string
type PatchUpdateNulls ¶
func (PatchUpdateNulls) String ¶
func (c PatchUpdateNulls) String() string
type PatchView ¶ added in v1.1.1
type PatchView struct { Schema string Name string DropViews []fmt.Stringer CreateViews []fmt.Stringer DropIndexes []fmt.Stringer CreateIndexes []fmt.Stringer }
func (*PatchView) AddCreateIndexPatch ¶ added in v1.1.1
func (*PatchView) AddCreateViewPatch ¶ added in v1.1.1
func (*PatchView) AddDropIndexPatch ¶ added in v1.1.1
func (*PatchView) AddDropViewPatch ¶ added in v1.1.1
type PgSelect ¶ added in v1.0.1
type PgSelect struct {
// contains filtered or unexported fields
}
type PgStore ¶
type PgStore struct { Store // contains filtered or unexported fields }
func (*PgStore) CheckStarted ¶
func (*PgStore) DbConfigTableFromModel ¶ added in v1.1.1
func (*PgStore) MD2SQLModel ¶ added in v1.1.1
func (*PgStore) Migrate ¶
func (sr *PgStore) Migrate(ctx context.Context, mProcessor MigrationProcessor) error
func (*PgStore) ModelObjectFrom ¶ added in v1.0.1
func (sr *PgStore) ModelObjectFrom(modelItem Storable) (ModelObject, error)
func (*PgStore) PrepQueryx ¶
func (*PgStore) PrepSelect ¶
func (*PgStore) PrepSelectCursorWalk ¶
func (*PgStore) PrepareQuery ¶
func (*PgStore) SaveModelConfig ¶ added in v1.1.1
func (*PgStore) SetUnsafe ¶
func (sr *PgStore) SetUnsafe()
SetUnsafe sets a version of Tx which will silently succeed to scan when columns in the SQL result have no fields in the destination struct.
func (PgStore) WithBeginTx ¶
type PostgresDefaultValuer ¶ added in v1.0.2
type PostgresDefaultValuer interface {
PostgresDefaultValue() string
}
type PostgresNullable ¶ added in v1.0.3
type PostgresNullable interface {
PostgresAllowNull() bool
}
type PostgresTyper ¶ added in v1.0.1
type PostgresTyper interface {
PostgresType() string
}
type PostgresTyperLn ¶ added in v1.0.3
type PostgresTyperLnPrec ¶ added in v1.0.3
type RowScanner ¶ added in v1.0.7
type RowScanner interface {
Scan(rows sqlx.ColScanner, prefix string) error
}
type RowsGenerator ¶ added in v1.0.9
type SQLView ¶ added in v1.0.2
type SQLView[T Storable] struct { V T MD *ModelDesc Filled []*FieldDescription }
func NewSQLView ¶ added in v1.0.2
func (*SQLView[T]) IsFullFilled ¶ added in v1.0.2
func (*SQLView[T]) Scan ¶ added in v1.0.2
func (mo *SQLView[T]) Scan(rows sqlx.ColScanner, prefix string) error
prefix is table alias with point at end, or empty string
func (*SQLView[T]) SetFullFilled ¶ added in v1.0.2
func (mo *SQLView[T]) SetFullFilled()
func (*SQLView[T]) SetUnfilled ¶ added in v1.0.2
type SQLViewErr ¶ added in v1.0.5
func (SQLViewErr[T]) JsonView ¶ added in v1.0.5
func (v SQLViewErr[T]) JsonView() JsonViewErr[T]
func (*SQLViewErr[T]) Scan ¶ added in v1.0.7
func (v *SQLViewErr[T]) Scan(rows sqlx.ColScanner, prefix string) error
prefix is table alias with point at end, or empty string
type SQLViewErrer ¶ added in v1.0.8
type SQLViewErrer[T Storable] interface { SQLView() SQLViewErr[T] }
type Shard ¶
type Storable ¶
type Storable interface {
StoreName() string
}
Storable is an interface that the model structure must implement
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (Store) GetModelDescription ¶
func (Store) GetModelDescriptionByType ¶
Получение описания модели из его reflect.Type
func (*Store) JSONBuildObjectSQL ¶
func (sr *Store) JSONBuildObjectSQL(md *ModelDesc, prefix string, onlyStructFieldNames ...string) string
создает строку вида json_build_object('jsonFieldName', prefixStructFieldName ...) если берутся поля от модели, то нужно использовать префикс ":". если от именованной таблицы tabl, то нужно использвать префикс "tabl.:" если с префиксом модели, то нужно использвать префикс ":ModelName."
func (Store) QueryReplacers ¶
func (s Store) QueryReplacers() map[sqlPattern]map[string]ReplaceEntry
type String ¶
type String string
func (*String) ConvertFrom ¶
store.Converter interface, n must contain zero value before call
func (String) MarshalJSON ¶ added in v1.0.2
func (String) PostgresAllowNull ¶ added in v1.0.3
func (String) PostgresDefaultValue ¶ added in v1.0.2
func (String) PostgresType ¶ added in v1.0.2
func (*String) UnmarshalJSON ¶ added in v1.0.2
type StringArray ¶
type StringArray []string
func (StringArray) MarshalJSON ¶
func (f StringArray) MarshalJSON() ([]byte, error)
func (StringArray) PostgresAllowNull ¶ added in v1.0.3
func (u StringArray) PostgresAllowNull() bool
func (StringArray) PostgresDefaultValue ¶ added in v1.0.2
func (StringArray) PostgresDefaultValue() string
func (StringArray) PostgresType ¶ added in v1.0.2
func (StringArray) PostgresType() string
func (*StringArray) Scan ¶
func (f *StringArray) Scan(value interface{}) error
func (*StringArray) UnmarshalJSON ¶
func (f *StringArray) UnmarshalJSON(b []byte) error
type Text ¶
type Text string
func (*Text) ConvertFrom ¶
func (Text) PostgresAllowNull ¶ added in v1.0.3
func (Text) PostgresDefaultValue ¶ added in v1.0.2
func (Text) PostgresType ¶ added in v1.0.2
type Time ¶
func (Time) AssignTo ¶
AssignToустанавливает значение целевой переменной с учетом ее типа. Поддерживаются типы: time.Time, Time, NullTime и указатели на них
func (*Time) ConvertFrom ¶
store.Converter interface, t must contain zero value before call
func (Time) FormatRus ¶
д (d) - день месяца (цифрами) без лидирующего нуля дд (dd) - день месяца (цифрами) с лидирующим нулем ддд (ddd) - краткое название дня недели дддд (dddd) - полное название дня недели М (M) - номер месяца (цифрами) без лидирующего нуля ММ (MM) - номер месяца (цифрами) с лидирующим нулем МММ (MMM) - краткое название месяца ММММ (MMMM) - полное название месяца К (Q) - номер квартала в году г (y) - номер года без века и лидирующего нуля гг (yy) - номер года без века с лидирующим нулем гггг (yyyy) - номер года с веком ч (h) - час в 24 часовом варианте без лидирующих нулей чч (hh) - час в 24 часовом варианте с лидирующим нулем м (m) - минута без лидирующего нуля мм (mm) - минута с лидирующим нулем с (s) - секунда без лидирующего нуля сс (ss) - секунда с лидирующим нулем ссс (sss) - миллисекунда с лидирующим нулем
func (Time) MarshalBinary ¶
func (Time) MarshalJSON ¶
func (Time) PostgresAllowNull ¶ added in v1.0.3
func (Time) PostgresDefaultValue ¶ added in v1.0.2
func (Time) PostgresType ¶ added in v1.0.2
func (*Time) UnmarshalBinary ¶
func (*Time) UnmarshalJSON ¶
type UUID ¶ added in v1.0.1
func (*UUID[T]) ConvertFrom ¶ added in v1.0.1
func (UUID[T]) MarshalJSON ¶ added in v1.0.1
func (UUID[T]) PostgresAllowNull ¶ added in v1.0.3
func (UUID[T]) PostgresDefaultValue ¶ added in v1.0.2
func (UUID[T]) PostgresType ¶ added in v1.0.1
func (*UUID[T]) UnmarshalJSON ¶ added in v1.0.1
type UUID58 ¶ added in v1.0.10
type UUID58 UUIDv4
func UUID58FromString ¶ added in v1.0.10
func UUID58MustFromString ¶ added in v1.0.10
func (*UUID58) ConvertFrom ¶ added in v1.0.10
store.Converter interface, u must contain zero value before call
func (UUID58) MarshalJSON ¶ added in v1.0.10
func (UUID58) PostgresAllowNull ¶ added in v1.0.10
func (UUID58) PostgresDefaultValue ¶ added in v1.0.10
func (UUID58) PostgresType ¶ added in v1.0.10
func (*UUID58) UnmarshalJSON ¶ added in v1.0.10
type UUIDJsonTyped ¶ added in v1.0.1
func (UUIDJsonTyped[T]) MarshalJSON ¶ added in v1.0.1
func (u UUIDJsonTyped[T]) MarshalJSON() ([]byte, error)
func (*UUIDJsonTyped[T]) UnmarshalJSON ¶ added in v1.0.1
func (u *UUIDJsonTyped[T]) UnmarshalJSON(b []byte) error
type UUIDv4 ¶
func UUIDFromString ¶ added in v1.0.1
func UUIDMustFromString ¶ added in v1.0.1
func (*UUIDv4) ConvertFrom ¶
store.Converter interface, u must contain zero value before call
func (UUIDv4) MarshalJSON ¶
func (UUIDv4) PostgresAllowNull ¶ added in v1.0.3
func (UUIDv4) PostgresDefaultValue ¶ added in v1.0.2
func (UUIDv4) PostgresType ¶ added in v1.0.2
func (*UUIDv4) UnmarshalJSON ¶
type UUIDv4Array ¶
type UUIDv4Array []UUIDv4
func (UUIDv4Array) MarshalJSON ¶
func (a UUIDv4Array) MarshalJSON() ([]byte, error)
func (UUIDv4Array) PostgresAllowNull ¶ added in v1.0.3
func (UUIDv4Array) PostgresAllowNull() bool
func (UUIDv4Array) PostgresDefaultValue ¶ added in v1.0.2
func (UUIDv4Array) PostgresDefaultValue() string
func (UUIDv4Array) PostgresType ¶ added in v1.0.2
func (UUIDv4Array) PostgresType() string
func (*UUIDv4Array) Raw ¶
func (a *UUIDv4Array) Raw() []UUIDv4
func (*UUIDv4Array) Scan ¶
func (a *UUIDv4Array) Scan(value interface{}) error
func (*UUIDv4Array) UnmarshalJSON ¶
func (a *UUIDv4Array) UnmarshalJSON(b []byte) error
type Uint64Array ¶
type Uint64Array []uint64
func (Uint64Array) MarshalJSON ¶
func (f Uint64Array) MarshalJSON() ([]byte, error)
func (Uint64Array) PostgresAllowNull ¶ added in v1.0.3
func (u Uint64Array) PostgresAllowNull() bool
func (Uint64Array) PostgresDefaultValue ¶ added in v1.0.2
func (Uint64Array) PostgresDefaultValue() string
func (Uint64Array) PostgresType ¶ added in v1.0.2
func (Uint64Array) PostgresType() string
func (*Uint64Array) Scan ¶
func (f *Uint64Array) Scan(value interface{}) error
func (*Uint64Array) UnmarshalJSON ¶
func (f *Uint64Array) UnmarshalJSON(b []byte) error
type UniqueObjects ¶ added in v1.0.1
type UniqueObjects struct {
// contains filtered or unexported fields
}
func NewUniqueObjects ¶ added in v1.0.1
func NewUniqueObjects() *UniqueObjects
func (*UniqueObjects) AddObject ¶ added in v1.0.1
func (uo *UniqueObjects) AddObject(data ModelObject) error
func (*UniqueObjects) Close ¶ added in v1.0.1
func (uo *UniqueObjects) Close()
func (*UniqueObjects) CopyObjects ¶ added in v1.0.1
func (uo *UniqueObjects) CopyObjects() (res []ModelObject)
func (*UniqueObjects) Object ¶ added in v1.0.1
func (uo *UniqueObjects) Object(id interface{}) (ModelObject, bool)
func (*UniqueObjects) Objects ¶ added in v1.0.1
func (uo *UniqueObjects) Objects() []ModelObject
func (*UniqueObjects) Reset ¶ added in v1.0.1
func (uo *UniqueObjects) Reset()
type Viewable ¶ added in v1.1.1
Viewable is an interface that the view-model structure must implement
type XID ¶ added in v1.0.1
func (XID[T]) MarshalJSON ¶ added in v1.0.1
func (XID[T]) PostgresAllowNull ¶ added in v1.0.3
func (XID[T]) PostgresDefaultValue ¶ added in v1.0.2
func (XID[T]) PostgresType ¶ added in v1.0.1
func (*XID[T]) UnmarshalJSON ¶ added in v1.0.1
type XIDJsonTyped ¶ added in v1.0.1
func (XIDJsonTyped[T]) MarshalJSON ¶ added in v1.0.1
func (u XIDJsonTyped[T]) MarshalJSON() ([]byte, error)
func (*XIDJsonTyped[T]) UnmarshalJSON ¶ added in v1.0.1
func (u *XIDJsonTyped[T]) UnmarshalJSON(b []byte) error
Source Files ¶
- bufpool.go
- collections.go
- dbconfig.go
- decimal.go
- errors.go
- fd.go
- ifaces.go
- inbind.go
- initdb.go
- jsonb.go
- jsonobjbuild.go
- jsonview.go
- logq.go
- md.go
- mdflds.go
- mdquery.go
- migrate.go
- migrateschema.go
- migratesql.go
- migrator.go
- migridx.go
- migrpatch.go
- model.go
- modelobject.go
- nullbool.go
- nulldecimal.go
- nullfloat.go
- nullint.go
- nulljsonb.go
- nullstring.go
- nulltext.go
- nulltime.go
- pgparty.go
- prepare.go
- qrepl.go
- qreplace.go
- rebind.go
- replace.go
- serial.go
- shard.go
- shards.go
- simpleprotocol.go
- snake.go
- sqltyps.go
- sqlview.go
- store.go
- storeq.go
- stringarray.go
- tags.go
- text.go
- time.go
- typeduuid.go
- uniqadd.go
- uuid.go
- uuid_array.go
- viewerr.go
- xid.go