sql

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PgSqlWireSet = wire.NewSet(
	GetConfig,
	NewDbConnection,
)

Functions

func NewDbConnection

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

Types

type AuditLog

type AuditLog struct {
	CreatedOn time.Time `sql:"created_on,type:timestamptz"`
	CreatedBy int32     `sql:"created_by,type:integer"`
	UpdatedOn time.Time `sql:"updated_on,type:timestamptz"`
	UpdatedBy int32     `sql:"updated_by,type:integer"`
}

func NewDefaultAuditLog added in v0.6.26

func NewDefaultAuditLog(userId int32) AuditLog

func (*AuditLog) CreateAuditLog added in v0.6.29

func (model *AuditLog) CreateAuditLog(userId int32)

CreateAuditLog can be used by any repository to create AuditLog for insert operation

func (*AuditLog) UpdateAuditLog added in v0.6.29

func (model *AuditLog) UpdateAuditLog(userId int32)

UpdateAuditLog can be used by any repository to update AuditLog for update operation

type Config

type Config struct {
	Addr            string `` /* 140-byte string literal not displayed */
	Port            string `env:"PG_PORT" envDefault:"5432" description:"port of postgresql service" example:"5432"`
	User            string `env:"PG_USER" envDefault:""  description:"user for postgres" example:"postgres"`
	Password        string `` /* 134-byte string literal not displayed */
	Database        string `` /* 152-byte string literal not displayed */
	CasbinDatabase  string `env:"CASBIN_DATABASE" envDefault:"casbin""`
	ApplicationName string `env:"APP" envDefault:"orchestrator" description:"Application name"`
	ReadTimeout     int64  `env:"PG_READ_TIMEOUT" envDefault:"30"`
	WriteTimeout    int64  `env:"PG_WRITE_TIMEOUT" envDefault:"30"`
	bean.PgQueryMonitoringConfig
}

CATEGORY=POSTGRES

func GetConfig

func GetConfig() (*Config, error)

type TransactionUtilImpl added in v0.6.19

type TransactionUtilImpl struct {
	// contains filtered or unexported fields
}

func NewTransactionUtilImpl added in v0.6.19

func NewTransactionUtilImpl(db *pg.DB) *TransactionUtilImpl

func (*TransactionUtilImpl) CommitTx added in v0.6.19

func (impl *TransactionUtilImpl) CommitTx(tx *pg.Tx) error

func (*TransactionUtilImpl) RollbackTx added in v0.6.19

func (impl *TransactionUtilImpl) RollbackTx(tx *pg.Tx) error

func (*TransactionUtilImpl) StartTx added in v0.6.19

func (impl *TransactionUtilImpl) StartTx() (*pg.Tx, error)

type TransactionWrapper added in v0.6.19

type TransactionWrapper interface {
	StartTx() (*pg.Tx, error)
	RollbackTx(tx *pg.Tx) error
	CommitTx(tx *pg.Tx) error
}

Jump to

Keyboard shortcuts

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