pgx

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGormLogger

func NewGormLogger(logger *log.Helper, config logger.Config) logger.Interface

func NewPostgres

func NewPostgres(logLevel string, dsn string, mLogger log.Logger) (*gorm.DB, error)

func ParsePostgresLogLevel

func ParsePostgresLogLevel(logLevel string) logger.LogLevel

Types

type BaseModel

type BaseModel struct {
	ID        int64     `gorm:"primarykey"              json:"id"         ch:"id"`
	CreatedAt time.Time `gorm:"not null;autoCreateTime" json:"created_at" ch:"created_at"`
	UpdatedAt time.Time `gorm:"not null;autoUpdateTime" json:"updated_at" ch:"updated_at"`
}

type BaseModelSoftDelete

type BaseModelSoftDelete struct {
	ID        int64                 `gorm:"primarykey"                          json:"id"`
	CreatedAt time.Time             `gorm:"not null;autoCreateTime"             json:"created_at"`
	UpdatedAt time.Time             `gorm:"not null;autoUpdateTime"             json:"updated_at"`
	DeletedAt soft_delete.DeletedAt `gorm:"not null;default:0;softDelete:milli" json:"deleted_at" ch:"deleted_at"`
}

type CtxKey

type CtxKey string
const FlagDisableSQLLog CtxKey = "disable_info_sql"

type JSONB

type JSONB[T any] struct {
	Val *T // 可为 nil
}

JSONB wraps any struct & handles pg jsonb ↔ Go struct transparently.

func (*JSONB[T]) Scan

func (j *JSONB[T]) Scan(src any) error

noinspection GoMixedReceiverTypes

func (JSONB[T]) Value

func (j JSONB[T]) Value() (driver.Value, error)

noinspection GoMixedReceiverTypes

Jump to

Keyboard shortcuts

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