db

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const RETRY_TIMES = 6

Variables

Functions

func NewDbConnection

func NewDbConnection(cfg *Config, logger *zap.SugaredLogger) (*gorm.DB, error)

Types

type Config

type Config struct {
	Addr     string `env:"ILLA_PG_ADDR" envDefault:"localhost"`
	Port     string `env:"ILLA_PG_PORT" envDefault:"5432"`
	User     string `env:"ILLA_PG_USER" envDefault:"illa_builder"`
	Password string `env:"ILLA_PG_PASSWORD" envDefault:"71De5JllWSetLYU"`
	Database string `env:"ILLA_PG_DATABASE" envDefault:"illa_builder"`
}

func GetConfig

func GetConfig() (*Config, error)

type JSONB

type JSONB map[string]interface{}

func (*JSONB) DecodeText

func (j *JSONB) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (JSONB) EncodeText

func (j JSONB) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (JSONB) GormDBDataType

func (JSONB) GormDBDataType(db *gorm.DB, field *schema.Field) string

GormDBDataType gorm db data type

func (JSONB) GormDataType

func (j JSONB) GormDataType() string

GormDataType gorm common data type

func (JSONB) MarshalJSON

func (j JSONB) MarshalJSON() ([]byte, error)

MarshalJSON to output non base64 encoded []byte

func (*JSONB) Scan

func (j *JSONB) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*JSONB) UnmarshalJSON

func (j *JSONB) UnmarshalJSON(b []byte) error

UnmarshalJSON to deserialize []byte

func (JSONB) Value

func (j JSONB) Value() (driver.Value, error)

Value implements the database/sql/driver Valuer interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL