Documentation
¶
Overview ¶
Package db contains function which helps to work with PostgreSQL
Package db contains function which helps to work with PostgreSQL ¶
Package db contains function which helps to work with PostgreSQL ¶
Package db contains function which helps to work with PostgreSQL
Index ¶
- Variables
- func HandleDbError(err error) error
- func IsAlreadyExistError(err error) bool
- func IsContextCanceledError(err error) bool
- func IsForeignKeyViolationError(err error) bool
- func IsInvalidLength(err error) bool
- func IsInvalidTextRepresentationError(err error) bool
- func IsInvalidValueError(err error) bool
- func IsNotFoundError(err error) bool
- func IsUniqueViolationError(err error) bool
- func New(cfg *Config, opts ...Option) (*sql.DB, *gorm.DB, error)
- func NewGormDB(cfg *Config, opts ...Option) (*sql.DB, error)
- func NewModule(p ModuleParams) (*sql.DB, *gorm.DB, error)
- type Config
- type ModuleParams
- type Option
- type Postgres
Constants ¶
This section is empty.
Variables ¶
Module for uber fx
Functions ¶
func HandleDbError ¶
func IsAlreadyExistError ¶
IsAlreadyExistError shows if entity already exist in db
func IsContextCanceledError ¶
IsContextCanceledError shows if operation was canceled
func IsForeignKeyViolationError ¶
IsForeignKeyViolationError shows if foreign key violation error
func IsInvalidLength ¶
IsInvalidValueError check if any field has invalid length
func IsInvalidTextRepresentationError ¶
Useful for invalid enum values
func IsInvalidValueError ¶
IsInvalidValueError shows if foreign key violation error
func IsNotFoundError ¶
IsNotFoundError shows if foreign key violation error
func IsUniqueViolationError ¶
Types ¶
type Config ¶
type Config struct {
Postgres Postgres
}
Config should be included as part of service config.
type ModuleParams ¶
ModuleParams contains module params
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option applies option
func WithMaxOpenConns ¶
WithMaxOpenConns set max open connections to database