Versions in this module Expand all Collapse all v6 v6.1.6 Sep 19, 2023 v6.1.5 Sep 18, 2023 v6.1.2 Aug 22, 2023 Changes in this version + const Delete + const Select + var AvailableDialects []string + var Color = true + var ConfigName = "database.yml" + var Connections = map[string]*Connection + var Debug = false + var ErrConfigFileNotFound = errors.New("unable to find pop config file") + var PaginatorPageKey = "page" + var PaginatorPerPageDefault = 20 + var PaginatorPerPageKey = "per_page" + func AddLookupPaths(paths ...string) error + func CanonicalDialect(synonym string) string + func CreateDB(c *Connection) error + func CreateSchemaMigrations(c *Connection) error + func DialectSupported(d string) bool + func DropDB(c *Connection) error + func IsZeroOfUnderlyingType(x interface{}) bool + func LoadConfigFile() error + func LoadFrom(r io.Reader) error + func LookupPaths() []string + func MigrationContent(mf Migration, c *Connection, r io.Reader, usingTemplate bool) (string, error) + func ParseConfig(r io.Reader) (map[string]*ConnectionDetails, error) + func SetEagerMode(eagerMode EagerMode) + func SetLogger(logger func(level logging.Level, s string, args ...interface{})) + func SetNowFunc(f func() time.Time) + func SetTxLogger(...) + type AfterCreateable interface + AfterCreate func(*Connection) error + type AfterDestroyable interface + AfterDestroy func(*Connection) error + type AfterEagerFindable interface + AfterEagerFind func(*Connection) error + type AfterFindable interface + AfterFind func(*Connection) error + type AfterSaveable interface + AfterSave func(*Connection) error + type AfterUpdateable interface + AfterUpdate func(*Connection) error + type AssociationMetaInfo struct + func NewAssociationMetaInfo(fi *reflectx.FieldInfo) *AssociationMetaInfo + type BeforeCreateable interface + BeforeCreate func(*Connection) error + type BeforeDestroyable interface + BeforeDestroy func(*Connection) error + type BeforeSaveable interface + BeforeSave func(*Connection) error + type BeforeUpdateable interface + BeforeUpdate func(*Connection) error + type BeforeValidateable interface + BeforeValidate func(*Connection) error + type Connection struct + Dialect dialect + Elapsed int64 + ID string + Store store + TX *Tx + func Connect(e string) (*Connection, error) + func NewConnection(deets *ConnectionDetails) (*Connection, error) + func (c *Connection) All(models interface{}) error + func (c *Connection) BelongsTo(model interface{}) *Query + func (c *Connection) BelongsToAs(model interface{}, as string) *Query + func (c *Connection) BelongsToThrough(bt, thru interface{}) *Query + func (c *Connection) Close() error + func (c *Connection) Context() context.Context + func (c *Connection) Count(model interface{}) (int, error) + func (c *Connection) Create(model interface{}, excludeColumns ...string) error + func (c *Connection) Destroy(model interface{}) error + func (c *Connection) Eager(fields ...string) *Connection + func (c *Connection) EagerPreload(fields ...string) *Query + func (c *Connection) Find(model interface{}, id interface{}) error + func (c *Connection) First(model interface{}) error + func (c *Connection) Last(model interface{}) error + func (c *Connection) Limit(limit int) *Query + func (c *Connection) Load(model interface{}, fields ...string) error + func (c *Connection) MigrationTableName() string + func (c *Connection) MigrationURL() string + func (c *Connection) NewTransaction() (*Connection, error) + func (c *Connection) NewTransactionContext(ctx context.Context) (*Connection, error) + func (c *Connection) NewTransactionContextOptions(ctx context.Context, options *sql.TxOptions) (*Connection, error) + func (c *Connection) Open() error + func (c *Connection) Order(stmt string, args ...interface{}) *Query + func (c *Connection) Paginate(page int, perPage int) *Query + func (c *Connection) PaginateFromParams(params PaginationParams) *Query + func (c *Connection) Q() *Query + func (c *Connection) RawQuery(stmt string, args ...interface{}) *Query + func (c *Connection) Reload(model interface{}) error + func (c *Connection) Rollback(fn func(tx *Connection)) error + func (c *Connection) Save(model interface{}, excludeColumns ...string) error + func (c *Connection) Scope(sf ScopeFunc) *Query + func (c *Connection) Select(fields ...string) *Query + func (c *Connection) String() string + func (c *Connection) Transaction(fn func(tx *Connection) error) error + func (c *Connection) TruncateAll() error + func (c *Connection) URL() string + func (c *Connection) Update(model interface{}, excludeColumns ...string) error + func (c *Connection) UpdateColumns(model interface{}, columnNames ...string) error + func (c *Connection) ValidateAndCreate(model interface{}, excludeColumns ...string) (*validate.Errors, error) + func (c *Connection) ValidateAndSave(model interface{}, excludeColumns ...string) (*validate.Errors, error) + func (c *Connection) ValidateAndUpdate(model interface{}, excludeColumns ...string) (*validate.Errors, error) + func (c *Connection) Where(stmt string, args ...interface{}) *Query + func (c *Connection) WithContext(ctx context.Context) *Connection + type ConnectionDetails struct + ConnMaxIdleTime time.Duration + ConnMaxLifetime time.Duration + Database string + Dialect string + Driver string + Encoding string + Host string + IdlePool int + InstrumentedDriverOptions []instrumentedsql.Opt + Options map[string]string + Password string + Pool int + Port string + RawOptions string + URL string + Unsafe bool + UseInstrumentedDriver bool + User string + func (cd *ConnectionDetails) Finalize() error + func (cd *ConnectionDetails) MigrationTableName() string + func (cd *ConnectionDetails) OptionsString(s string) string + func (cd *ConnectionDetails) RetryLimit() int + func (cd *ConnectionDetails) RetrySleep() time.Duration + type DownMigrations struct + func (mfs DownMigrations) Less(i, j int) bool + type EagerMode uint8 + const EagerDefault + const EagerInclude + const EagerPreload + type FileMigrator struct + Path string + func NewFileMigrator(path string, c *Connection) (FileMigrator, error) + type GroupClause struct + Field string + func (c GroupClause) String() string + type HavingClause struct + Arguments []interface{} + Condition string + func (c HavingClause) String() string + type Match struct + DBType string + Direction string + Name string + NoTransaction bool + Type string + Version string + func ParseMigrationFilename(filename string) (*Match, error) + type Migration struct + DBType string + Direction string + Name string + NoTransaction bool + Path string + Runner func(Migration, *Connection) error + Type string + Version string + func (mf Migration) Run(c *Connection) error + type MigrationBox struct + FS fs.FS + func NewMigrationBox(fsys fs.FS, c *Connection) (MigrationBox, error) + type Migrations []Migration + func (mfs *Migrations) Filter(f func(mf Migration) bool) + func (mfs Migrations) Len() int + func (mfs Migrations) Swap(i, j int) + type Migrator struct + Connection *Connection + DownMigrations DownMigrations + SchemaPath string + UpMigrations UpMigrations + func NewMigrator(c *Connection) Migrator + func (m Migrator) CreateSchemaMigrations() error + func (m Migrator) Down(dumpSchema bool, step int) error + func (m Migrator) DumpMigrationSchema() error + func (m Migrator) Reset(dumpSchema bool) error + func (m Migrator) Status(out io.Writer) (err error) + func (m Migrator) Up(dumpSchema bool) error + func (m Migrator) UpLogOnly(dumpSchema bool) (err error) + func (m Migrator) UpTo(dumpSchema bool, step int) (applied int, err error) + type Model struct + As string + func NewModel(v Value, ctx context.Context) *Model + func (m *Model) Alias() string + func (m *Model) Columns() columns.Columns + func (m *Model) ID() interface{} + func (m *Model) IDField() string + func (m *Model) PrimaryKeyType() (string, error) + func (m *Model) TableName() string + func (m *Model) WhereID() string + func (m *Model) WhereNamedID() string + type ModelMetaInfo struct + Model *Model + func NewModelMetaInfo(model *Model) *ModelMetaInfo + type PaginationParams interface + Get func(key string) string + type Paginator struct + CurrentEntriesSize int + Offset int + Page int + PerPage int + TotalEntriesSize int + TotalPages int + func NewPaginator(page int, perPage int) *Paginator + func NewPaginatorFromParams(params PaginationParams) *Paginator + func (p Paginator) Paginate() string + func (p Paginator) String() string + type Query struct + Connection *Connection + Operation operation + Paginator *Paginator + RawSQL *clause + func Q(c *Connection) *Query + func (q *Query) All(models interface{}) error + func (q *Query) BelongsTo(model interface{}) *Query + func (q *Query) BelongsToAs(model interface{}, as string) *Query + func (q *Query) BelongsToThrough(bt, thru interface{}) *Query + func (q *Query) Clone(targetQ *Query) + func (q *Query) Delete(model interface{}) error + func (q *Query) Eager(fields ...string) *Query + func (q *Query) EagerPreload(fields ...string) *Query + func (q *Query) Exec() error + func (q *Query) ExecWithCount() (int, error) + func (q *Query) Exists(model interface{}) (bool, error) + func (q *Query) Find(model interface{}, id interface{}) error + func (q *Query) First(model interface{}) error + func (q *Query) GroupBy(field string, fields ...string) *Query + func (q *Query) Having(condition string, args ...interface{}) *Query + func (q *Query) InnerJoin(table string, on string, args ...interface{}) *Query + func (q *Query) Join(table string, on string, args ...interface{}) *Query + func (q *Query) Last(model interface{}) error + func (q *Query) LeftJoin(table string, on string, args ...interface{}) *Query + func (q *Query) LeftOuterJoin(table string, on string, args ...interface{}) *Query + func (q *Query) Limit(limit int) *Query + func (q *Query) Order(stmt string, args ...interface{}) *Query + func (q *Query) Paginate(page int, perPage int) *Query + func (q *Query) PaginateFromParams(params PaginationParams) *Query + func (q *Query) RawQuery(stmt string, args ...interface{}) *Query + func (q *Query) RightJoin(table string, on string, args ...interface{}) *Query + func (q *Query) RightOuterJoin(table string, on string, args ...interface{}) *Query + func (q *Query) Scope(sf ScopeFunc) *Query + func (q *Query) Select(fields ...string) *Query + func (q *Query) UpdateQuery(model interface{}, columnNames ...string) (int64, error) + func (q *Query) Where(stmt string, args ...interface{}) *Query + func (q Query) Count(model interface{}) (int, error) + func (q Query) CountByField(model interface{}, field string) (int, error) + func (q Query) ToSQL(model *Model, addColumns ...string) (string, []interface{}) + type ScopeFunc func(q *Query) *Query + type TableNameAble interface + TableName func() string + type TableNameAbleWithContext interface + TableName func(ctx context.Context) string + type Tx struct + ID int + func (tx *Tx) Close() error + func (tx *Tx) NamedQueryContext(ctx context.Context, query string, arg interface{}) (*sqlx.Rows, error) + func (tx *Tx) Transaction() (*Tx, error) + func (tx *Tx) TransactionContext(ctx context.Context) (*Tx, error) + func (tx *Tx) TransactionContextOptions(_ context.Context, _ *sql.TxOptions) (*Tx, error) + type UpMigrations struct + func (mfs UpMigrations) Less(i, j int) bool + type Value interface Other modules containing this package github.com/friesencr/pop