Documentation ¶
Index ¶
- Constants
- Variables
- func Close()
- func InitDb(config structure.DBConfiguration)
- func InitDbV2(config structure.DBConfiguration, callback func(db *DBManager))
- func InitDbV2WithSchema(config structure.DBConfiguration, schema string, callback func(db *DBManager))
- func InitDbWithCurrentSchema(config structure.DBConfiguration)
- func InitDbWithSchema(config structure.DBConfiguration, schema string)
- func NewDbConnection(config structure.DBConfiguration) (*pg.DB, error)
- func NewLogQueryHook(level logrus.Level) pg.QueryHook
- func ResolveMigrationsDirectrory() string
- func RunInTransaction(f interface{}) error
- func RunInTransactionV2(pdb *pg.DB, f interface{}) error
- type CrudRepository
- func (r *CrudRepository) CreateEntity(entity interface{}) (interface{}, error)
- func (r *CrudRepository) DeleteEntities(identities []int32) (int, error)
- func (r *CrudRepository) DeleteLongEntities(identities []int64) (int, error)
- func (r *CrudRepository) GetAllEntities(identities []int32) (interface{}, error)
- func (r *CrudRepository) GetAllLongEntities(identities []int64) (interface{}, error)
- func (r *CrudRepository) GetEntityById(identity int32) (interface{}, error)
- func (r *CrudRepository) GetEntityByName(name string) (interface{}, error)
- func (r *CrudRepository) UpdateEntity(entity interface{}) (interface{}, error)
- type DBManager
- type ErrorEvent
- type Option
- type RxDbClient
Constants ¶
View Source
const (
SchemaParam = "db_schema"
)
Variables ¶
View Source
var (
ErrNotConnected = errors.New("db: not connected")
)
Functions ¶
func InitDb ¶
func InitDb(config structure.DBConfiguration)
func InitDbV2 ¶
func InitDbV2(config structure.DBConfiguration, callback func(db *DBManager))
func InitDbV2WithSchema ¶
func InitDbV2WithSchema(config structure.DBConfiguration, schema string, callback func(db *DBManager))
func InitDbWithCurrentSchema ¶
func InitDbWithCurrentSchema(config structure.DBConfiguration)
func InitDbWithSchema ¶
func InitDbWithSchema(config structure.DBConfiguration, schema string)
func NewDbConnection ¶
func NewDbConnection(config structure.DBConfiguration) (*pg.DB, error)
func ResolveMigrationsDirectrory ¶
func ResolveMigrationsDirectrory() string
func RunInTransaction ¶
func RunInTransaction(f interface{}) error
func RunInTransactionV2 ¶
Types ¶
type CrudRepository ¶
type CrudRepository struct { DB orm.DB EntityType reflect.Type CastToSlice func(interface{}) interface{} CastToEntity func(interface{}) interface{} }
func (*CrudRepository) CreateEntity ¶
func (r *CrudRepository) CreateEntity(entity interface{}) (interface{}, error)
func (*CrudRepository) DeleteEntities ¶
func (r *CrudRepository) DeleteEntities(identities []int32) (int, error)
func (*CrudRepository) DeleteLongEntities ¶
func (r *CrudRepository) DeleteLongEntities(identities []int64) (int, error)
func (*CrudRepository) GetAllEntities ¶
func (r *CrudRepository) GetAllEntities(identities []int32) (interface{}, error)
func (*CrudRepository) GetAllLongEntities ¶
func (r *CrudRepository) GetAllLongEntities(identities []int64) (interface{}, error)
func (*CrudRepository) GetEntityById ¶
func (r *CrudRepository) GetEntityById(identity int32) (interface{}, error)
func (*CrudRepository) GetEntityByName ¶
func (r *CrudRepository) GetEntityByName(name string) (interface{}, error)
func (*CrudRepository) UpdateEntity ¶
func (r *CrudRepository) UpdateEntity(entity interface{}) (interface{}, error)
type DBManager ¶
func GetDBManager ¶
func GetDBManager() *DBManager
type ErrorEvent ¶
type ErrorEvent struct {
// contains filtered or unexported fields
}
func (ErrorEvent) Error ¶
func (er ErrorEvent) Error() string
type Option ¶
type Option func(rdc *RxDbClient)
func WithInitializingErrorHandler ¶
func WithInitializingErrorHandler(eh errorHandler) Option
func WithInitializingHandler ¶
func WithInitializingHandler(handler initHandler) Option
func WithMigrationsEnsuring ¶
func WithMigrationsEnsuring() Option
func WithQueryHooks ¶ added in v1.3.0
func WithSchemaAutoInjecting ¶
func WithSchemaAutoInjecting() Option
func WithSchemaEnsuring ¶
func WithSchemaEnsuring() Option
type RxDbClient ¶
type RxDbClient struct {
// contains filtered or unexported fields
}
func NewRxDbClient ¶
func NewRxDbClient(opts ...Option) *RxDbClient
func (*RxDbClient) Close ¶
func (rc *RxDbClient) Close() error
func (*RxDbClient) ReceiveConfiguration ¶
func (rc *RxDbClient) ReceiveConfiguration(config structure.DBConfiguration)
func (*RxDbClient) RunInTransaction ¶
func (rc *RxDbClient) RunInTransaction(f interface{}) error
func (*RxDbClient) Unsafe ¶ added in v1.3.0
func (rc *RxDbClient) Unsafe() *pg.DB
func (*RxDbClient) Visit ¶
func (rc *RxDbClient) Visit(v visitor) error
Click to show internal directories.
Click to hide internal directories.