Versions in this module Expand all Collapse all v0 v0.1.1 Oct 15, 2019 v0.1.0 Sep 29, 2019 Changes in this version + func ClearRegistry() + func Databases() map[string]Database + func Register(apps ...AppSettings) + func Registry() map[string]*Application + func Start(options map[string]Database) error + func Stop() error + type AppSettings struct + Models []*Model + Name string + Path string + func NewApp(name string, path string, models ...*Model) AppSettings + type Application struct + func (app Application) FullPath() string + func (app Application) Models() map[string]*Model + func (app Application) Name() string + func (app Application) Path() string + type BooleanField struct + Blank bool + Column string + Default bool + DefaultFalse bool + Index bool + Null bool + func (f BooleanField) DBColumn(name string) string + func (f BooleanField) DataType(dvr string) string + func (f BooleanField) DefaultValue() (Value, bool) + func (f BooleanField) DisplayValue(val Value) string + func (f BooleanField) DriverValue(v Value, dvr string) (interface{}, error) + func (f BooleanField) HasIndex() bool + func (f BooleanField) IsAuto() bool + func (f BooleanField) IsAutoNow() bool + func (f BooleanField) IsAutoNowAdd() bool + func (f BooleanField) IsNull() bool + func (f BooleanField) IsPK() bool + func (f BooleanField) IsUnique() bool + func (f BooleanField) Recipient() interface{} + func (f BooleanField) Value(rec interface{}) Value + type Builder interface + New func() Builder + type CharField struct + Blank bool + Choices []Choice + Column string + Default string + DefaultEmpty bool + Index bool + MaxLength int + Null bool + PrimaryKey bool + Unique bool + func (f CharField) DBColumn(name string) string + func (f CharField) DataType(driver string) string + func (f CharField) DefaultValue() (Value, bool) + func (f CharField) DisplayValue(val Value) string + func (f CharField) DriverValue(val Value, dvr string) (interface{}, error) + func (f CharField) HasIndex() bool + func (f CharField) IsAuto() bool + func (f CharField) IsAutoNow() bool + func (f CharField) IsAutoNowAdd() bool + func (f CharField) IsNull() bool + func (f CharField) IsPK() bool + func (f CharField) IsUnique() bool + func (f CharField) Recipient() interface{} + func (f CharField) Value(rec interface{}) Value + type Choice struct + Label string + Value Value + type Conditioner interface + And func(conditioner Conditioner) Conditioner + AndNot func(conditioner Conditioner) Conditioner + Conditions func() map[string]Value + Next func() (conditioner Conditioner, isOr bool, isNot bool) + Or func(conditioner Conditioner) Conditioner + OrNot func(conditioner Conditioner) Conditioner + Root func() (conditioner Conditioner, isChain bool) + type Container interface + type ContainerError struct + Trace ErrorTrace + func (e *ContainerError) Error() string + type Database struct + Driver string + Name string + Password string + User string + func (db Database) BeginTx() (*Transaction, error) + func (db Database) Id() string + type DatabaseError struct + Name string + Trace ErrorTrace + func (e *DatabaseError) Error() string + type DateField struct + AutoNow bool + AutoNowAdd bool + Blank bool + Choices []Choice + Column string + Default time.Time + Index bool + Null bool + PrimaryKey bool + Unique bool + func (f *DateField) UnmarshalJSON(data []byte) error + func (f DateField) DBColumn(name string) string + func (f DateField) DataType(dvr string) string + func (f DateField) DefaultValue() (Value, bool) + func (f DateField) DisplayValue(val Value) string + func (f DateField) DriverValue(v Value, dvr string) (interface{}, error) + func (f DateField) HasIndex() bool + func (f DateField) IsAuto() bool + func (f DateField) IsAutoNow() bool + func (f DateField) IsAutoNowAdd() bool + func (f DateField) IsNull() bool + func (f DateField) IsPK() bool + func (f DateField) IsUnique() bool + func (f DateField) MarshalJSON() ([]byte, error) + func (f DateField) Recipient() interface{} + func (f DateField) Value(rec interface{}) Value + type DateTimeField struct + AutoNow bool + AutoNowAdd bool + Blank bool + Choices []Choice + Column string + Default time.Time + Index bool + Null bool + PrimaryKey bool + Unique bool + func (f DateTimeField) DBColumn(name string) string + func (f DateTimeField) DataType(dvr string) string + func (f DateTimeField) DefaultValue() (Value, bool) + func (f DateTimeField) DisplayValue(val Value) string + func (f DateTimeField) DriverValue(v Value, dvr string) (interface{}, error) + func (f DateTimeField) HasIndex() bool + func (f DateTimeField) IsAuto() bool + func (f DateTimeField) IsAutoNow() bool + func (f DateTimeField) IsAutoNowAdd() bool + func (f DateTimeField) IsNull() bool + func (f DateTimeField) IsPK() bool + func (f DateTimeField) IsUnique() bool + func (f DateTimeField) MarshalJSON() ([]byte, error) + func (f DateTimeField) Recipient() interface{} + func (f DateTimeField) Value(rec interface{}) Value + type Dispatcher struct + Objects Manager + func New(name string, fields Fields, options Options) *Dispatcher + func (d Dispatcher) New(values Container) (*Instance, error) + type Engine interface + AddColumns func(model *Model, fields Fields) error + AddIndex func(model *Model, name string, fields ...string) error + BeginTx func() (Engine, error) + CommitTx func() error + CountRows func(model *Model, options QueryOptions) (int64, error) + CreateTable func(model *Model, force bool) error + DB func() *sql.DB + DeleteRows func(model *Model, options QueryOptions) (int64, error) + DropColumns func(model *Model, fields ...string) error + DropIndex func(model *Model, name string) error + DropTable func(model *Model) error + Exists func(model *Model, options QueryOptions) (bool, error) + GetRows func(model *Model, options QueryOptions) (Rows, error) + InsertRow func(model *Model, values Values) (int64, error) + RenameTable func(old *Model, new *Model) error + RollbackTx func() error + SelectQuery func(model *Model, options QueryOptions) (Query, error) + Start func(Database) (Engine, error) + Stop func() error + Tx func() *sql.Tx + TxSupport func() bool + UpdateRows func(model *Model, values Values, options QueryOptions) (int64, error) + type ErrorTrace struct + App *Application + Err error + Field string + Model *Model + func (e ErrorTrace) String() string + type Field interface + DBColumn func(fieldName string) string + DataType func(driver string) string + DefaultValue func() (val Value, hasDefault bool) + DisplayValue func(val Value) string + DriverValue func(val Value, driver string) (interface{}, error) + HasIndex func() bool + IsAuto func() bool + IsAutoNow func() bool + IsAutoNowAdd func() bool + IsNull func() bool + IsPK func() bool + IsUnique func() bool + Recipient func() interface{} + Value func(recipient interface{}) Value + type Fields map[string]Field + func (fields *Fields) UnmarshalJSON(data []byte) error + func (fields Fields) MarshalJSON() ([]byte, error) + type GenericQuerySet struct + func (qs GenericQuerySet) Count() (int64, error) + func (qs GenericQuerySet) Delete() (int64, error) + func (qs GenericQuerySet) Exclude(c Conditioner) QuerySet + func (qs GenericQuerySet) Exists() (bool, error) + func (qs GenericQuerySet) Filter(c Conditioner) QuerySet + func (qs GenericQuerySet) Get(c Conditioner) (*Instance, error) + func (qs GenericQuerySet) Load() ([]*Instance, error) + func (qs GenericQuerySet) Model() *Model + func (qs GenericQuerySet) New(m *Model, parent QuerySet) QuerySet + func (qs GenericQuerySet) Only(fields ...string) QuerySet + func (qs GenericQuerySet) Query() (Query, error) + func (qs GenericQuerySet) Slice(start int64, end int64) ([]*Instance, error) + func (qs GenericQuerySet) Update(container Container) (int64, error) + func (qs GenericQuerySet) WithContainer(container Container) QuerySet + func (qs GenericQuerySet) WithDB(database string) QuerySet + func (qs GenericQuerySet) WithTx(tx *Transaction) QuerySet + func (qs GenericQuerySet) Wrap(parent GenericQuerySet) QuerySet + type Getter interface + Get func(name string) (val Value, ok bool) + type Indexes map[string][]string + type Instance struct + func (i Instance) Container() Container + func (i Instance) Delete() error + func (i Instance) DeleteOn(target interface{}) error + func (i Instance) Display(name string) string + func (i Instance) Get(name string) Value + func (i Instance) GetIf(name string) (val Value, hasField bool) + func (i Instance) Model() *Model + func (i Instance) Save(fields ...string) error + func (i Instance) SaveOn(target interface{}, fields ...string) error + func (i Instance) Set(name string, val Value) error + func (i Instance) SetValues(values Container) error + type IntegerField struct + Auto bool + Blank bool + Choices []Choice + Column string + Default int32 + DefaultZero bool + Index bool + Null bool + PrimaryKey bool + Unique bool + func (f IntegerField) DBColumn(name string) string + func (f IntegerField) DataType(dvr string) string + func (f IntegerField) DefaultValue() (Value, bool) + func (f IntegerField) DisplayValue(val Value) string + func (f IntegerField) DriverValue(v Value, dvr string) (interface{}, error) + func (f IntegerField) HasIndex() bool + func (f IntegerField) IsAuto() bool + func (f IntegerField) IsAutoNow() bool + func (f IntegerField) IsAutoNowAdd() bool + func (f IntegerField) IsNull() bool + func (f IntegerField) IsPK() bool + func (f IntegerField) IsUnique() bool + func (f IntegerField) Recipient() interface{} + func (f IntegerField) Value(rec interface{}) Value + type Manager struct + Model *Model + QuerySet QuerySet + func (m Manager) All() QuerySet + func (m Manager) Create(values Container) (*Instance, error) + func (m Manager) CreateOn(target interface{}, values Container) (*Instance, error) + func (m Manager) Exclude(c Conditioner) QuerySet + func (m Manager) Filter(c Conditioner) QuerySet + func (m Manager) Get(c Conditioner) (*Instance, error) + func (m Manager) GetQuerySet() QuerySet + func (m Manager) WithContainer(container Container) QuerySet + type MockedEngine struct + Args *MockedEngineArgs + Results *MockedEngineResults + func (e MockedEngine) AddColumns(model *Model, fields Fields) error + func (e MockedEngine) AddIndex(m *Model, name string, fields ...string) error + func (e MockedEngine) BeginTx() (Engine, error) + func (e MockedEngine) Calls(method string) int + func (e MockedEngine) CommitTx() error + func (e MockedEngine) CountRows(m *Model, opt QueryOptions) (int64, error) + func (e MockedEngine) CreateTable(model *Model, force bool) error + func (e MockedEngine) DB() *sql.DB + func (e MockedEngine) DeleteRows(m *Model, opt QueryOptions) (int64, error) + func (e MockedEngine) DropColumns(model *Model, fields ...string) error + func (e MockedEngine) DropIndex(model *Model, name string) error + func (e MockedEngine) DropTable(model *Model) error + func (e MockedEngine) Exists(m *Model, opt QueryOptions) (bool, error) + func (e MockedEngine) GetRows(model *Model, opt QueryOptions) (Rows, error) + func (e MockedEngine) InsertRow(model *Model, values Values) (int64, error) + func (e MockedEngine) RenameTable(old *Model, new *Model) error + func (e MockedEngine) Reset() + func (e MockedEngine) RollbackTx() error + func (e MockedEngine) SelectQuery(m *Model, opt QueryOptions) (Query, error) + func (e MockedEngine) Start(db Database) (Engine, error) + func (e MockedEngine) Stop() error + func (e MockedEngine) Tx() *sql.Tx + func (e MockedEngine) TxSupport() bool + func (e MockedEngine) UpdateRows(model *Model, values Values, options QueryOptions) (int64, error) + type MockedEngineArgs struct + AddColumns struct{ ... } + AddIndex struct{ ... } + CountRows struct{ ... } + CreateTable *Model + DeleteRows struct{ ... } + DropColumns struct{ ... } + DropIndex struct{ ... } + DropTable *Model + Exists struct{ ... } + GetRows struct{ ... } + InsertRow struct{ ... } + RenameTable struct{ ... } + SelectQuery struct{ ... } + UpdateRows struct{ ... } + func (a *MockedEngineArgs) Reset() + type MockedEngineResults struct + AddColumns error + AddIndex error + BeginTx error + CommitTx error + CopyTable error + CountRows struct{ ... } + CreateTable error + DeleteRows struct{ ... } + DropColumns error + DropIndex error + DropTable error + Exists struct{ ... } + GetRows struct{ ... } + InsertRow struct{ ... } + RenameTable error + RollbackTx error + SelectQuery struct{ ... } + Stop error + TxSupport bool + UpdateRows struct{ ... } + func (r *MockedEngineResults) Reset() + type Model struct + func (m *Model) AddField(name string, field Field) error + func (m *Model) AddIndex(name string, fields ...string) error + func (m *Model) Register(app *Application) error + func (m *Model) RemoveField(name string) error + func (m *Model) RemoveIndex(name string) error + func (m *Model) SetupIndexes() error + func (m *Model) SetupPrimaryKey() error + func (m Model) App() *Application + func (m Model) Container() Container + func (m Model) Fields() Fields + func (m Model) Indexes() Indexes + func (m Model) Name() string + func (m Model) Table() string + type MultipleObjectsError struct + Trace ErrorTrace + func (e *MultipleObjectsError) Error() string + type NullInt32 struct + Int32 int32 + Valid bool + func (n *NullInt32) Scan(value interface{}) error + func (n NullInt32) Value() (driver.Value, error) + type NullTime struct + Time time.Time + Valid bool + func (d *NullTime) Scan(value interface{}) error + func (d NullTime) Value() (driver.Value, error) + type ObjectNotFoundError struct + Trace ErrorTrace + func (e *ObjectNotFoundError) Error() string + type Options struct + Container Container + Indexes Indexes + Table string + type PostgresEngine struct + func (e PostgresEngine) AddColumns(model *Model, fields Fields) error + func (e PostgresEngine) AddIndex(m *Model, name string, fields ...string) error + func (e PostgresEngine) BeginTx() (Engine, error) + func (e PostgresEngine) CommitTx() error + func (e PostgresEngine) CountRows(m *Model, opt QueryOptions) (int64, error) + func (e PostgresEngine) CreateTable(model *Model, force bool) error + func (e PostgresEngine) DB() *sql.DB + func (e PostgresEngine) DeleteRows(m *Model, opt QueryOptions) (int64, error) + func (e PostgresEngine) DropColumns(model *Model, fields ...string) error + func (e PostgresEngine) DropIndex(model *Model, name string) error + func (e PostgresEngine) DropTable(model *Model) error + func (e PostgresEngine) Exists(m *Model, opt QueryOptions) (bool, error) + func (e PostgresEngine) GetRows(model *Model, opt QueryOptions) (Rows, error) + func (e PostgresEngine) InsertRow(model *Model, values Values) (int64, error) + func (e PostgresEngine) RenameTable(old *Model, new *Model) error + func (e PostgresEngine) RollbackTx() error + func (e PostgresEngine) SelectQuery(m *Model, opt QueryOptions) (Query, error) + func (e PostgresEngine) Start(db Database) (Engine, error) + func (e PostgresEngine) Stop() error + func (e PostgresEngine) Tx() *sql.Tx + func (e PostgresEngine) TxSupport() bool + func (e PostgresEngine) UpdateRows(model *Model, values Values, options QueryOptions) (int64, error) + type Q map[string]Value + func (q Q) And(next Conditioner) Conditioner + func (q Q) AndNot(next Conditioner) Conditioner + func (q Q) Conditions() map[string]Value + func (q Q) Next() (Conditioner, bool, bool) + func (q Q) Or(next Conditioner) Conditioner + func (q Q) OrNot(next Conditioner) Conditioner + func (q Q) Root() (Conditioner, bool) + type Query struct + Args []interface{} + Stmt string + type QueryOptions struct + Conditioner Conditioner + End int64 + Fields []string + Start int64 + type QuerySet interface + Count func() (int64, error) + Delete func() (int64, error) + Exclude func(c Conditioner) QuerySet + Exists func() (bool, error) + Filter func(c Conditioner) QuerySet + Get func(c Conditioner) (*Instance, error) + Load func() ([]*Instance, error) + Model func() *Model + New func(model *Model, parent QuerySet) QuerySet + Only func(fields ...string) QuerySet + Query func() (Query, error) + Slice func(start int64, end int64) ([]*Instance, error) + Update func(values Container) (int64, error) + WithContainer func(container Container) QuerySet + WithDB func(database string) QuerySet + WithTx func(tx *Transaction) QuerySet + Wrap func(qs GenericQuerySet) QuerySet + type QuerySetError struct + Trace ErrorTrace + func (e *QuerySetError) Error() string + type Rows interface + Close func() error + Err func() error + Next func() bool + Scan func(dest ...interface{}) error + type Setter interface + Set func(name string, val Value, field Field) error + type SqliteEngine struct + func (e SqliteEngine) AddColumns(model *Model, fields Fields) error + func (e SqliteEngine) AddIndex(m *Model, name string, fields ...string) error + func (e SqliteEngine) BeginTx() (Engine, error) + func (e SqliteEngine) CommitTx() error + func (e SqliteEngine) CountRows(m *Model, opt QueryOptions) (int64, error) + func (e SqliteEngine) CreateTable(model *Model, force bool) error + func (e SqliteEngine) DB() *sql.DB + func (e SqliteEngine) DeleteRows(m *Model, opt QueryOptions) (int64, error) + func (e SqliteEngine) DropColumns(model *Model, fields ...string) error + func (e SqliteEngine) DropIndex(model *Model, name string) error + func (e SqliteEngine) DropTable(model *Model) error + func (e SqliteEngine) Exists(m *Model, opt QueryOptions) (bool, error) + func (e SqliteEngine) GetRows(model *Model, opt QueryOptions) (Rows, error) + func (e SqliteEngine) InsertRow(model *Model, values Values) (int64, error) + func (e SqliteEngine) RenameTable(old *Model, new *Model) error + func (e SqliteEngine) RollbackTx() error + func (e SqliteEngine) SelectQuery(m *Model, opt QueryOptions) (Query, error) + func (e SqliteEngine) Start(db Database) (Engine, error) + func (e SqliteEngine) Stop() error + func (e SqliteEngine) Tx() *sql.Tx + func (e SqliteEngine) TxSupport() bool + func (e SqliteEngine) UpdateRows(model *Model, values Values, options QueryOptions) (int64, error) + type TimeField struct + AutoNow bool + AutoNowAdd bool + Blank bool + Choices []Choice + Column string + Default time.Time + Index bool + Null bool + PrimaryKey bool + Unique bool + func (f *TimeField) UnmarshalJSON(data []byte) error + func (f TimeField) DBColumn(name string) string + func (f TimeField) DataType(dvr string) string + func (f TimeField) DefaultValue() (Value, bool) + func (f TimeField) DisplayValue(val Value) string + func (f TimeField) DriverValue(v Value, dvr string) (interface{}, error) + func (f TimeField) HasIndex() bool + func (f TimeField) IsAuto() bool + func (f TimeField) IsAutoNow() bool + func (f TimeField) IsAutoNowAdd() bool + func (f TimeField) IsNull() bool + func (f TimeField) IsPK() bool + func (f TimeField) IsUnique() bool + func (f TimeField) MarshalJSON() ([]byte, error) + func (f TimeField) Recipient() interface{} + func (f TimeField) Value(rec interface{}) Value + type Transaction struct + DB Database + func (tx Transaction) Commit() error + func (tx Transaction) Rollback() error + type Value interface + type Values map[string]Value + func (vals Values) Get(key string) (Value, bool) + func (vals Values) New() Builder + func (vals Values) Set(key string, val Value, field Field) error