Documentation
¶
Index ¶
- type Dao
- func (d *Dao) Begin(ctx context.Context) (*sql.Tx, error)
- func (d *Dao) Close() error
- func (d *Dao) FetchValues(ctx context.Context, tableName string, keyConditions datamodels.Record, ...) (map[string]interface{}, error)
- func (d *Dao) GetBuilder() squirrel.StatementBuilderType
- func (d *Dao) GetDb() *sql.DB
- func (d *Dao) MaxId(ctx context.Context, tableName string, fieldName string) (int64, error)
- func (d *Dao) Ping(ctx context.Context) error
- type IPrimaryDao
- type IReplicaDao
- type PostgresDao
- func (d *PostgresDao) AddColumns(ctx context.Context, table string, cols []datamodels.Column) error
- func (d *PostgresDao) BatchUpdateOnConflict(ctx context.Context, tableName string, records []datamodels.Record, ...) error
- func (d *PostgresDao) CastDate(field string) string
- func (d *PostgresDao) CreateForeignKey(ctx context.Context, table, col, refTable, refCol string) error
- func (d *PostgresDao) CreateIndex(ctx context.Context, table string, fields []string, isUniq bool) error
- func (d *PostgresDao) CreateTable(ctx context.Context, table string, cols []datamodels.Column) error
- func (d *PostgresDao) DropForeignKey(ctx context.Context, table, fkName string) error
- func (d *PostgresDao) FetchValues(ctx context.Context, tableName string, keyConditions datamodels.Record, ...) (map[string]interface{}, error)
- func (d *PostgresDao) GetColumnDefinitions(ctx context.Context, table string) ([]datamodels.Column, error)
- func (d *PostgresDao) Increase(ctx context.Context, tableName string, keyConditions datamodels.Record, ...) (int64, error)
- func (d *PostgresDao) MaxId(ctx context.Context, tableName string, fieldName string) (int64, error)
- func (d *PostgresDao) RenameColumn(ctx context.Context, table, oldName, newName string) error
- func (d *PostgresDao) RenameTable(ctx context.Context, oldName, newName string) error
- func (d *PostgresDao) UpdateOnConflict(ctx context.Context, tableName string, data datamodels.Record, ...) (bool, error)
- type SqliteDao
- func (d *SqliteDao) AddColumns(ctx context.Context, table string, cols []datamodels.Column) error
- func (d *SqliteDao) BatchUpdateOnConflict(ctx context.Context, tableName string, records []datamodels.Record, ...) error
- func (d *SqliteDao) CastDate(field string) string
- func (d *SqliteDao) CreateForeignKey(ctx context.Context, table, col, refTable, refCol string) error
- func (d *SqliteDao) CreateIndex(ctx context.Context, table string, fields []string, isUniq bool) error
- func (d *SqliteDao) CreateTable(ctx context.Context, table string, cols []datamodels.Column) error
- func (d *SqliteDao) DropForeignKey(ctx context.Context, table, fkName string) error
- func (d *SqliteDao) FetchValues(ctx context.Context, tableName string, keyConditions datamodels.Record, ...) (map[string]interface{}, error)
- func (d *SqliteDao) GetColumnDefinitions(ctx context.Context, table string) ([]datamodels.Column, error)
- func (d *SqliteDao) Increase(ctx context.Context, tableName string, keyConditions datamodels.Record, ...) (int64, error)
- func (d *SqliteDao) MaxId(ctx context.Context, tableName string, fieldName string) (int64, error)
- func (d *SqliteDao) RenameColumn(ctx context.Context, table, oldName, newName string) error
- func (d *SqliteDao) RenameTable(ctx context.Context, oldName, newName string) error
- func (d *SqliteDao) UpdateOnConflict(ctx context.Context, tableName string, data datamodels.Record, ...) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dao ¶
type Dao struct {
// contains filtered or unexported fields
}
func (*Dao) FetchValues ¶
func (*Dao) GetBuilder ¶
func (d *Dao) GetBuilder() squirrel.StatementBuilderType
type IPrimaryDao ¶
type IPrimaryDao interface {
IReplicaDao
Begin(ctx context.Context) (*sql.Tx, error)
CreateTable(ctx context.Context, table string, cols []datamodels.Column) error
AddColumns(ctx context.Context, table string, cols []datamodels.Column) error
CreateForeignKey(ctx context.Context, table, col, refTable, refCol string) error
CreateIndex(ctx context.Context, table string, fields []string, isUniq bool) error
UpdateOnConflict(ctx context.Context, tableName string, data datamodels.Record, keyFields []string) (bool, error)
BatchUpdateOnConflict(ctx context.Context, tableName string, records []datamodels.Record, keyFields []string) error
Increase(ctx context.Context, tableName string, keyConditions datamodels.Record, valueField string, initVal, delta int64) (int64, error)
RenameTable(ctx context.Context, oldName, newName string) error
RenameColumn(ctx context.Context, table, oldName, newName string) error
DropForeignKey(ctx context.Context, table, fkName string) error
}
func CreateDao ¶
func CreateDao(provider descriptors.DatabaseProvider, connectionString string) (IPrimaryDao, error)
type IReplicaDao ¶
type IReplicaDao interface {
GetColumnDefinitions(ctx context.Context, table string) ([]datamodels.Column, error)
FetchValues(ctx context.Context, tableName string, keyConditions datamodels.Record, inField string, inValues []interface{}, valueField string) (map[string]interface{}, error)
MaxId(ctx context.Context, tableName string, fieldName string) (int64, error)
CastDate(field string) string
GetBuilder() squirrel.StatementBuilderType
GetDb() *sql.DB
Ping(ctx context.Context) error
Close() error
}
type PostgresDao ¶
type PostgresDao struct {
Dao
}
func NewPostgresDao ¶
func NewPostgresDao(connectionString string) (*PostgresDao, error)
func (*PostgresDao) AddColumns ¶
func (d *PostgresDao) AddColumns(ctx context.Context, table string, cols []datamodels.Column) error
func (*PostgresDao) BatchUpdateOnConflict ¶
func (d *PostgresDao) BatchUpdateOnConflict(ctx context.Context, tableName string, records []datamodels.Record, keyFields []string) error
func (*PostgresDao) CastDate ¶
func (d *PostgresDao) CastDate(field string) string
func (*PostgresDao) CreateForeignKey ¶
func (d *PostgresDao) CreateForeignKey(ctx context.Context, table, col, refTable, refCol string) error
func (*PostgresDao) CreateIndex ¶
func (*PostgresDao) CreateTable ¶
func (d *PostgresDao) CreateTable(ctx context.Context, table string, cols []datamodels.Column) error
func (*PostgresDao) DropForeignKey ¶
func (d *PostgresDao) DropForeignKey(ctx context.Context, table, fkName string) error
func (*PostgresDao) FetchValues ¶
func (d *PostgresDao) FetchValues(ctx context.Context, tableName string, keyConditions datamodels.Record, inField string, inValues []interface{}, valueField string) (map[string]interface{}, error)
func (*PostgresDao) GetColumnDefinitions ¶
func (d *PostgresDao) GetColumnDefinitions(ctx context.Context, table string) ([]datamodels.Column, error)
func (*PostgresDao) Increase ¶
func (d *PostgresDao) Increase(ctx context.Context, tableName string, keyConditions datamodels.Record, valueField string, initVal, delta int64) (int64, error)
func (*PostgresDao) RenameColumn ¶
func (d *PostgresDao) RenameColumn(ctx context.Context, table, oldName, newName string) error
func (*PostgresDao) RenameTable ¶
func (d *PostgresDao) RenameTable(ctx context.Context, oldName, newName string) error
func (*PostgresDao) UpdateOnConflict ¶
func (d *PostgresDao) UpdateOnConflict(ctx context.Context, tableName string, data datamodels.Record, keyFields []string) (bool, error)
type SqliteDao ¶
type SqliteDao struct {
Dao
}
func NewSqliteDao ¶
func (*SqliteDao) AddColumns ¶
func (*SqliteDao) BatchUpdateOnConflict ¶
func (*SqliteDao) CreateForeignKey ¶
func (*SqliteDao) CreateIndex ¶
func (*SqliteDao) CreateTable ¶
func (*SqliteDao) DropForeignKey ¶
func (*SqliteDao) FetchValues ¶
func (*SqliteDao) GetColumnDefinitions ¶
func (*SqliteDao) RenameColumn ¶
func (*SqliteDao) RenameTable ¶
Click to show internal directories.
Click to hide internal directories.