Documentation
¶
Index ¶
- func GetManager() *manager
- func NewCreateMongoWrapperErr(err error) error
- func NewCreateSqlWrapperErr(err error) error
- func NewDeleteModelErr(table string, data any, err error) error
- func NewInsertModelErr(table string, data any, err error) error
- func NewMigrateErr(err error) error
- func NewMongoDeleteErr(collection string, filter any, err error) error
- func NewMongoFindQueryErr(collection string, filter any, err error) error
- func NewNotExistServiceNameErr(serviceName string) error
- func NewNotImplementedErr() error
- func NewNotSupportedDbTypeErr(dbType string) error
- func NewSelectQueryErr(q string, err error) error
- func NewUpdateModelErr(table string, data any, err error) error
- type Config
- type CreateMongoWrapperErr
- type CreateSqlWrapperErr
- type DeleteModelErr
- type InsertModelErr
- type LoggerConfig
- type MigrateErr
- type Mongo
- type MongoDeleteErr
- type MongoFindQueryErr
- type MongoLoggerConfig
- type MongoWrapper
- type Mysql
- type MysqlSpecificConfig
- type NotExistServiceNameErr
- type NotImplementedErr
- type NotSupportedDbTypeErr
- type Postgresql
- type PostgresqlSpecificConfig
- type SelectQueryErr
- type SqlConfigurable
- type SqlWrapper
- type Sqlite
- type UpdateModelErr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetManager ¶
func GetManager() *manager
GetManager - This function returns singleton instance of Db Manager
func NewCreateMongoWrapperErr ¶
NewCreateMongoWrapperErr - return a new instance of CreateMongoWrapperErr
func NewCreateSqlWrapperErr ¶
NewCreateSqlWrapperErr - return a new instance of CreateSqlWrapperErr
func NewDeleteModelErr ¶
NewDeleteModelErr - return a new instance of DeleteModelErr
func NewInsertModelErr ¶
NewInsertModelErr - return a new instance of InsertModelErr
func NewMigrateErr ¶
NewMigrateErr - return a new instance of MigrateErr
func NewMongoDeleteErr ¶
NewMongoDeleteErr - return a new instance of MongoDeleteErr
func NewMongoFindQueryErr ¶
NewMongoFindQueryErr - return a new instance of MongoFindQueryErr
func NewNotExistServiceNameErr ¶
NewNotExistServiceNameErr - return a new instance of NotExistServiceNameErr
func NewNotImplementedErr ¶
func NewNotImplementedErr() error
NewNotImplementedErr - return a new instance of NotImplementedErr
func NewNotSupportedDbTypeErr ¶
NewNotSupportedDbTypeErr - return a new instance of NotSupportedDbTypeErr
func NewSelectQueryErr ¶
NewSelectQueryErr - return a new instance of SelectQueryErr
Types ¶
type Config ¶
type Config struct { SkipDefaultTransaction bool `json:"skip_default_transaction"` DryRun bool `json:"dry_run"` PrepareStmt bool `json:"prepare_stmt"` DisableAutomaticPing bool `json:"disable_automatic_ping"` DisableForeignKeyConstraintWhenMigrating bool `json:"disable_foreign_key_constraint_when_migrating"` IgnoreRelationshipsWhenMigrating bool `json:"ignore_relationships_when_migrating"` DisableNestedTransaction bool `json:"disable_nested_transaction"` }
type CreateMongoWrapperErr ¶
type CreateMongoWrapperErr struct {
Err error
}
CreateMongoWrapperErr Error
func (*CreateMongoWrapperErr) Error ¶
func (err *CreateMongoWrapperErr) Error() string
Error method - satisfying error interface
type CreateSqlWrapperErr ¶
type CreateSqlWrapperErr struct {
Err error
}
CreateSqlWrapperErr Error
func (*CreateSqlWrapperErr) Error ¶
func (err *CreateSqlWrapperErr) Error() string
Error method - satisfying error interface
type DeleteModelErr ¶
type DeleteModelErr struct { Err error // contains filtered or unexported fields }
DeleteModelErr Error
func (*DeleteModelErr) Error ¶
func (err *DeleteModelErr) Error() string
Error method - satisfying error interface
type InsertModelErr ¶
type InsertModelErr struct { Err error // contains filtered or unexported fields }
InsertModelErr Error
func (*InsertModelErr) Error ¶
func (err *InsertModelErr) Error() string
Error method - satisfying error interface
type LoggerConfig ¶
type MigrateErr ¶
type MigrateErr struct {
Err error
}
MigrateErr Error
func (*MigrateErr) Error ¶
func (err *MigrateErr) Error() string
Error method - satisfying error interface
type MongoDeleteErr ¶
type MongoDeleteErr struct { Err error // contains filtered or unexported fields }
MongoDeleteErr Error
func (*MongoDeleteErr) Error ¶
func (err *MongoDeleteErr) Error() string
Error method - satisfying error interface
type MongoFindQueryErr ¶
type MongoFindQueryErr struct { Err error // contains filtered or unexported fields }
MongoFindQueryErr Error
func (*MongoFindQueryErr) Error ¶
func (err *MongoFindQueryErr) Error() string
Error method - satisfying error interface
type MongoLoggerConfig ¶
type MongoWrapper ¶
type MongoWrapper struct {
// contains filtered or unexported fields
}
SqlWrapper struct
func NewMongoWrapper ¶
func NewMongoWrapper(name string) (*MongoWrapper, error)
NewMongoWrapper - create a new instance of MongoWrapper and returns it
type Mysql ¶
type Mysql struct { DatabaseName string `json:"db"` Username string `json:"username"` Password string `json:"password"` Host string `json:"host"` Port string `json:"port"` Protocol string `json:"protocol"` Options map[string]string `json:"options"` Config *Config `json:"config"` LoggerConfig *LoggerConfig `json:"logger"` SpecificConfig *MysqlSpecificConfig `json:"specific_config"` }
type MysqlSpecificConfig ¶
type MysqlSpecificConfig struct { DefaultStringSize uint `json:"default_string_size"` DisableDatetimePrecision bool `json:"disable_datetime_precision"` DefaultDatetimePrecision int `json:"default_datetime_precision"` SupportRenameIndex bool `json:"support_rename_index"` SupportRenameColumn bool `json:"support_rename_column"` SkipInitializeWithVersion bool `json:"skip_initialize_with_version"` DisableWithReturning bool `json:"disable_with_returning"` SupportNullAsDefaultValue bool `json:"support_null_as_default_value"` SupportRenameColumnUnique bool `json:"support_rename_column_unique"` }
type NotExistServiceNameErr ¶
type NotExistServiceNameErr struct {
// contains filtered or unexported fields
}
NotExistServiceNameErr Error
func (*NotExistServiceNameErr) Error ¶
func (err *NotExistServiceNameErr) Error() string
Error method - satisfying error interface
type NotImplementedErr ¶
type NotImplementedErr struct { }
NotImplementedErr Error
func (*NotImplementedErr) Error ¶
func (err *NotImplementedErr) Error() string
Error method - satisfying error interface
type NotSupportedDbTypeErr ¶
type NotSupportedDbTypeErr struct {
// contains filtered or unexported fields
}
NotSupportedDbTypeErr Error
func (*NotSupportedDbTypeErr) Error ¶
func (err *NotSupportedDbTypeErr) Error() string
Error method - satisfying error interface
type Postgresql ¶
type Postgresql struct { DatabaseName string `json:"db"` Username string `json:"username"` Password string `json:"password"` Host string `json:"host"` Port string `json:"port"` Options map[string]string `json:"options"` Config *Config `json:"config"` LoggerConfig *LoggerConfig `json:"logger"` SpecificConfig *PostgresqlSpecificConfig `json:"specific_config"` }
type PostgresqlSpecificConfig ¶
type PostgresqlSpecificConfig struct { PreferSimpleProtocol bool `json:"prefer_simple_protocol"` WithoutReturning bool `json:"without_returning"` MaxIdleConnCount int64 `json:"max_idle_conn_count"` MaxOpenConnCount int64 `json:"max_open_conn_count"` ConnMaxLifetime int64 `json:"conn_max_lifetime"` }
type SelectQueryErr ¶
type SelectQueryErr struct { Err error // contains filtered or unexported fields }
SelectQueryErr Error
func (*SelectQueryErr) Error ¶
func (err *SelectQueryErr) Error() string
Error method - satisfying error interface
type SqlConfigurable ¶
type SqlConfigurable interface { Sqlite | Mysql | Postgresql }
type SqlWrapper ¶
type SqlWrapper[T SqlConfigurable] struct { // contains filtered or unexported fields }
SqlWrapper struct
func NewSqlWrapper ¶
func NewSqlWrapper[T SqlConfigurable](name string, dbType string) (*SqlWrapper[T], error)
NewSqlWrapper - create a new instance of SqlWrapper and returns it
func (*SqlWrapper[T]) AttachMigrationFunc ¶
func (s *SqlWrapper[T]) AttachMigrationFunc(f func(migrator gorm.Migrator) error) error
AttachMigrationFunc - attach migration function to be called by end user
func (*SqlWrapper[T]) GetDb ¶
func (s *SqlWrapper[T]) GetDb() (*gorm.DB, error)
GetDb - return associated internal Db
func (*SqlWrapper[T]) Migrate ¶
func (s *SqlWrapper[T]) Migrate(models ...interface{}) error
Migrate - migrate models to the database
func (*SqlWrapper[T]) RegisterLogger ¶
func (s *SqlWrapper[T]) RegisterLogger(l types.Logger)
RegisterLogger - register logger instance
type Sqlite ¶
type Sqlite struct { FileName string `json:"db"` Options map[string]string `json:"options"` Config *Config `json:"config"` LoggerConfig *LoggerConfig `json:"logger"` }
type UpdateModelErr ¶
type UpdateModelErr struct { Err error // contains filtered or unexported fields }
UpdateModelErr Error
func (*UpdateModelErr) Error ¶
func (err *UpdateModelErr) Error() string
Error method - satisfying error interface