Versions in this module Expand all Collapse all v1 v1.0.4 Mar 14, 2020 v1.0.3 Mar 14, 2020 v1.0.2 Mar 14, 2020 Changes in this version + const ConditionOperatorAnd + const ConditionOperatorOr + const ConditionOperatorXor + var DefaultSystemColumns = SystemColumns + var DefaultSystemColumnsSoft = SystemColumns + func CreateModelFile(schema string, table string, path string) (*os.File, string, error) + func MakeModel(db Queryer, path string, schema string, table string, templatePath string, ...) error + func ModelColumn(model IModel, field interface{}) string + func ModelUpdateQuery(model IModel, condition *Condition, fields ...interface{}) (sql string, params []interface{}, e goerr.IError) + type Column struct + DataType string + Default *string + Description *string + ForeignColumnName *string + ForeignIsSoft bool + ForeignSchema *string + ForeignTable *string + HasUniqueIndex bool + Import string + IsArray bool + IsCreated bool + IsDeleted bool + IsNullable bool + IsPrimaryKey bool + IsUpdated bool + ModelName string + ModelType string + Name string + Schema string + Sequence *string + Table string + Tags string + UniqueIndexName *string + type Columns []Column + func GetTableColumns(dbo Queryer, schema string, table string, sysCols SystemColumns) (*Columns, error) + func (c Columns) GetImports() []string + type Condition struct + func NewSqlCondition(operator string) *Condition + func (c *Condition) AddArgument(values ...interface{}) *Condition + func (c *Condition) AddExpression(expression string, values ...interface{}) *Condition + func (c *Condition) GetArguments() []interface{} + func (c *Condition) IsEmpty() bool + func (c *Condition) Merge(operator string, conditions ...*Condition) *Condition + func (c *Condition) String() string + type Connection interface + GetConnMaxLifetime func() int + GetDbType func() string + GetMaxConnection func() int + GetMaxIdleConns func() int + String func() string + type ConnectionConfig struct + ConnectionIdleLifetime int + Host string + MaxConnections int + MaxIdleConnections int + Name string + Password string + Port int + User string + func (cc *ConnectionConfig) GetConnMaxLifetime() int + func (cc *ConnectionConfig) GetMaxConnection() int + func (cc *ConnectionConfig) GetMaxIdleConns() int + type DBO struct + Connection Connection + func (dbo *DBO) Begin() (*SqlTx, error) + func (dbo *DBO) Exec(query string, args ...interface{}) (sql.Result, error) + func (dbo *DBO) Prepare(query string) (*SqlStmt, error) + func (dbo *DBO) Query(query string, args ...interface{}) (*sql.Rows, error) + func (dbo *DBO) QueryRow(query string, args ...interface{}) *sql.Row + func (dbo DBO) Init() (*DBO, error) + type IMigrationFile interface + Down func(tx *SqlTx) error + GetVersion func() string + Up func(tx *SqlTx) error + type IModel interface + Columns func() []string + Delete func(q Queryer) goerr.IError + Load func(q Queryer) goerr.IError + Save func(q Queryer) goerr.IError + Table func() string + Values func() []interface{} + type ISoftModel interface + SoftDelete func(q Queryer) goerr.IError + SoftLoad func(q Queryer) goerr.IError + SoftRecover func(q Queryer) goerr.IError + type Iterator struct + func NewIterator(len int) *Iterator + func (c *Iterator) Count() int + func (c *Iterator) Cursor() int + func (c *Iterator) Next() bool + func (c *Iterator) Reset() *Iterator + func (c *Iterator) SetCount(count int) *Iterator + type Logger interface + Print func(v ...interface{}) + Printf func(format string, v ...interface{}) + Println func(v ...interface{}) + type Migration struct + Config ConnectionConfig + DBO *DBO + MigrationPath string + Registry MigrationRegistry + RegistryPath string + RegistryXPath string + func (m *Migration) CreateMigrationFile(class string, name string) error + func (m *Migration) Downgrade(class string, version string) error + func (m *Migration) GetTemplate() *template.Template + func (m *Migration) InitMigration(class string) error + func (m *Migration) Upgrade(class string) error + type MigrationRegistry map[string][]IMigrationFile + type Options struct + Debug bool + Logger Logger + type PostgresConnectionConfig struct + BinaryParameters bool + SSLMode string + func (pcc *PostgresConnectionConfig) GetDbType() string + func (pcc *PostgresConnectionConfig) String() string + type Query struct + func NewQuery() *Query + func (f *Query) AddOrder(expression ...string) *Query + func (f *Query) Columns(column ...string) *Query + func (f *Query) From(table ...string) *Query + func (f *Query) GetArguments() []interface{} + func (f *Query) GetWith(name string) *Query + func (f *Query) GroupBy(fields ...string) *Query + func (f *Query) Having() *Condition + func (f *Query) ModelColumns(model ...IModel) *Query + func (f *Query) ModelFrom(model ...IModel) *Query + func (f *Query) Relate(relation ...string) *Query + func (f *Query) ResetColumns() *Query + func (f *Query) ResetFrom() *Query + func (f *Query) ResetGroupBy() *Query + func (f *Query) ResetOrder() *Query + func (f *Query) ResetRelations() *Query + func (f *Query) ResetWith() *Query + func (f *Query) SetPagination(limit int, offset int) *Query + func (f *Query) Where() *Condition + func (f *Query) With(name string, qb *Query) *Query + func (f Query) String() string + type Queryer interface + Exec func(query string, args ...interface{}) (sql.Result, error) + Prepare func(query string) (*SqlStmt, error) + Query func(query string, args ...interface{}) (*sql.Rows, error) + QueryRow func(query string, args ...interface{}) *sql.Row + type SqlStmt struct + func (st *SqlStmt) Exec(args ...interface{}) (sql.Result, error) + func (st *SqlStmt) Query(args ...interface{}) (*sql.Rows, error) + func (st *SqlStmt) QueryRow(args ...interface{}) *sql.Row + type SqlTx struct + func (tx *SqlTx) Exec(query string, args ...interface{}) (sql.Result, error) + func (tx *SqlTx) Prepare(query string) (*SqlStmt, error) + func (tx *SqlTx) Query(query string, args ...interface{}) (*sql.Rows, error) + func (tx *SqlTx) QueryRow(query string, args ...interface{}) *sql.Row + func (tx *SqlTx) Stmt(stmt *SqlStmt) *SqlStmt + type SystemColumns struct + Created string + Deleted string + Updated string