gormf

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: GPL-3.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Logger        = (*LogrusLogger)(logrus.StandardLogger())
	DefaultConfig = &gorm.Config{Logger: Logger}
)

Functions

func CollectTaggedColumns

func CollectTaggedColumns(entity interface{}, setting string) []string

CollectTaggedColumns collects all columns from this entity tagged with a setting from this entity and all its embedded structs.

func OnConflictClause

func OnConflictClause(entity interface{}, setting string, updateAll bool, doUpdates clause.Set) *clause.OnConflict

OnConflictClause generates ON CONFLICT clause containing columns tagged with "setting" in the struct of "entity".

Types

type DB

type DB struct {
	*gorm.DB
	Driver, Conn string
}

DB is a gorm.DB wrapper implementing io.Closer interface.

func (*DB) Close

func (c *DB) Close() error

func (*DB) Labels added in v0.10.4

func (c *DB) Labels() me3x.Labels

type JSONB

type JSONB json.RawMessage

JSONB provides PostgreSQL jsonb type support for gorm.

func ToJSONB

func ToJSONB(value interface{}) (JSONB, error)

ToJSONB converts the specified value to jsonb.

func (JSONB) GormDataType

func (j JSONB) GormDataType() string

func (*JSONB) Scan

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

func (JSONB) String

func (j JSONB) String() string

func (JSONB) Unmarshal

func (j JSONB) Unmarshal(value interface{}) error

func (JSONB) Value

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

type LogrusLogger

type LogrusLogger logrus.Logger

LogrusLogger is an adapter for logrus.Logger allowing it to be used in gorm.Config.

func (*LogrusLogger) Error

func (l *LogrusLogger) Error(ctx context.Context, s string, i ...interface{})

func (*LogrusLogger) Info

func (l *LogrusLogger) Info(ctx context.Context, s string, i ...interface{})

func (*LogrusLogger) LogMode

func (*LogrusLogger) Trace

func (l *LogrusLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error)

func (*LogrusLogger) Unmask

func (l *LogrusLogger) Unmask() *logrus.Logger

func (*LogrusLogger) Warn

func (l *LogrusLogger) Warn(ctx context.Context, s string, i ...interface{})

Jump to

Keyboard shortcuts

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