Documentation ¶
Index ¶
- Variables
- func CreateTx(ctx context.Context, ta TxAble) (tx *sqlx.Tx, err error)
- func GetTx(ctx context.Context, ta TxAble) (context.Context, *sqlx.Tx, func(), func() error, error)
- type Datastore
- type Metadata
- type NullString
- type Postgres
- func (pg *Postgres) BeginTx() (*sqlx.Tx, error)
- func (pg *Postgres) Migrate(currentMigrationVersions ...uint) error
- func (pg *Postgres) NewMigrate() (*migrate.Migrate, error)
- func (pg *Postgres) RawDB() *sqlx.DB
- func (pg *Postgres) RollbackTx(tx *sqlx.Tx)
- func (pg *Postgres) RollbackTxAndHandle(tx *sqlx.Tx) error
- type TxAble
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // CurrentMigrationVersion holds the default migration version CurrentMigrationVersion = uint(69) // MigrationTracks holds the migration version for a given track (eyeshade, promotion, wallet) MigrationTracks = map[string]uint{ "eyeshade": 20, } )
Functions ¶
Types ¶
type Datastore ¶
type Datastore interface { RawDB() *sqlx.DB NewMigrate() (*migrate.Migrate, error) Migrate(...uint) error RollbackTxAndHandle(tx *sqlx.Tx) error RollbackTx(tx *sqlx.Tx) BeginTx() (*sqlx.Tx, error) }
Datastore holds generic methods
type Metadata ¶
type Metadata map[string]interface{}
Metadata - type which represents key/value pair metadata
type NullString ¶
type NullString struct {
sql.NullString
}
NullString is a type that lets ya get a null field from the database
func (*NullString) MarshalJSON ¶
func (ns *NullString) MarshalJSON() ([]byte, error)
MarshalJSON for NullString
func (*NullString) UnmarshalJSON ¶
func (ns *NullString) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshalls NullString
type Postgres ¶
Postgres is a Datastore wrapper around a postgres database
func NewPostgres ¶
func NewPostgres( databaseURL string, performMigration bool, migrationTrack string, dbStatsPrefix ...string, ) (*Postgres, error)
NewPostgres creates a new Postgres Datastore
func (*Postgres) NewMigrate ¶
NewMigrate creates a Migrate instance given a Postgres instance with an active database connection
func (*Postgres) RollbackTx ¶
RollbackTx rolls back a transaction (useful with defer)
Click to show internal directories.
Click to hide internal directories.