gormx

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Reset       = "\033[0m"
	Red         = "\033[31m"
	Green       = "\033[32m"
	Yellow      = "\033[33m"
	Blue        = "\033[34m"
	Magenta     = "\033[35m"
	Cyan        = "\033[36m"
	White       = "\033[37m"
	BlueBold    = "\033[34;1m"
	MagentaBold = "\033[35;1m"
	RedBold     = "\033[31;1m"
	YellowBold  = "\033[33;1m"
)

Colors

Variables

View Source
var File_store_gormx_conf_proto protoreflect.FileDescriptor

Functions

func ErrDryRunModeUnsupported

func ErrDryRunModeUnsupported(err error) error

ErrDryRunModeUnsupported dry run mode unsupported

func ErrEmptySlice

func ErrEmptySlice(err error) error

ErrEmptySlice empty slice found

func ErrInvalidDB

func ErrInvalidDB(err error) error

ErrInvalidDB invalid db

func ErrInvalidData

func ErrInvalidData(err error) error

ErrInvalidData unsupported data

func ErrInvalidField

func ErrInvalidField(err error) error

ErrInvalidField invalid field

func ErrInvalidTransaction

func ErrInvalidTransaction(err error) error

func ErrInvalidValue

func ErrInvalidValue(err error) error

ErrInvalidValue invalid value

func ErrInvalidValueOfLength

func ErrInvalidValueOfLength(err error) error

ErrInvalidValueOfLength invalid values do not match length

func ErrMissingWhereClause

func ErrMissingWhereClause(err error) error

ErrMissingWhereClause missing where clause

func ErrModelValueRequired

func ErrModelValueRequired(err error) error

ErrModelValueRequired model value required

func ErrNotImplemented

func ErrNotImplemented(err error) error

ErrNotImplemented not implemented

func ErrPrimaryKeyRequired

func ErrPrimaryKeyRequired(err error) error

ErrPrimaryKeyRequired primary keys required

func ErrRegistered

func ErrRegistered(err error) error

ErrRegistered registered

func ErrUnsupportedDriver

func ErrUnsupportedDriver(err error) error

ErrUnsupportedDriver unsupported driver

func ErrUnsupportedRelation

func ErrUnsupportedRelation(err error) error

ErrUnsupportedRelation unsupported relations

func GormErrRecordNotFound

func GormErrRecordNotFound(err error) error

GormErrRecordNotFound 找不到记录

func IsErrInvalidTransaction

func IsErrInvalidTransaction(err error) bool

func IsGormErrRecordNotFound

func IsGormErrRecordNotFound(err error) bool

func NewGormTracingHook

func NewGormTracingHook(opts ...tracing.Option) gorm.Plugin

func WrapGormError

func WrapGormError(err error) error

WrapGormError 转换错误

Types

type Conf

type Conf struct {
	Driver   string `protobuf:"bytes,1,opt,name=driver,proto3" json:"driver,omitempty"`
	Source   string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"`
	LogLevel int32  `protobuf:"varint,3,opt,name=logLevel,proto3" json:"logLevel,omitempty"`
	// contains filtered or unexported fields
}

func (*Conf) Descriptor deprecated

func (*Conf) Descriptor() ([]byte, []int)

Deprecated: Use Conf.ProtoReflect.Descriptor instead.

func (*Conf) GetDriver

func (x *Conf) GetDriver() string

func (*Conf) GetLogLevel

func (x *Conf) GetLogLevel() int32

func (*Conf) GetSource

func (x *Conf) GetSource() string

func (*Conf) ProtoMessage

func (*Conf) ProtoMessage()

func (*Conf) ProtoReflect

func (x *Conf) ProtoReflect() protoreflect.Message

func (*Conf) Reset

func (x *Conf) Reset()

func (*Conf) String

func (x *Conf) String() string

func (*Conf) Validate

func (m *Conf) Validate() error

Validate checks the field values on Conf with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type ConfValidationError

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

ConfValidationError is the validation error returned by Conf.Validate if the designated constraints aren't met.

func (ConfValidationError) Cause

func (e ConfValidationError) Cause() error

Cause function returns cause value.

func (ConfValidationError) Error

func (e ConfValidationError) Error() string

Error satisfies the builtin error interface

func (ConfValidationError) ErrorName

func (e ConfValidationError) ErrorName() string

ErrorName returns error name.

func (ConfValidationError) Field

func (e ConfValidationError) Field() string

Field function returns field value.

func (ConfValidationError) Key

func (e ConfValidationError) Key() bool

Key function returns key value.

func (ConfValidationError) Reason

func (e ConfValidationError) Reason() string

Reason function returns reason value.

type DB

type DB = gorm.DB

func MustNew

func MustNew(c *Conf) *DB

func New

func New(c *Conf) (*DB, error)

type DBTextMapCarrier

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

func (*DBTextMapCarrier) Get

func (carrier *DBTextMapCarrier) Get(key string) string

Get returns the value associated with the passed key.

func (*DBTextMapCarrier) Keys

func (carrier *DBTextMapCarrier) Keys() []string

Keys lists the keys stored in this carrier.

func (*DBTextMapCarrier) Set

func (carrier *DBTextMapCarrier) Set(key string, value string)

Set stores the key-value pair.

type GormTracingHook

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

func (*GormTracingHook) Initialize

func (p *GormTracingHook) Initialize(db *gorm.DB) error

func (*GormTracingHook) Name

func (p *GormTracingHook) Name() string

type Logger

type Logger struct {
	log.ZapLogger

	// grom
	logger.Config
	// contains filtered or unexported fields
}

func NewLogger

func NewLogger(config logger.Config, core zapcore.Core) *Logger

func (*Logger) Error

func (l *Logger) Error(ctx context.Context, msg string, data ...interface{})

Error print error messages

func (*Logger) Info

func (l *Logger) Info(ctx context.Context, msg string, data ...interface{})

Info print info

func (*Logger) LogMode

func (l *Logger) LogMode(level logger.LogLevel) logger.Interface

LogMode log mode

func (*Logger) Trace

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

Trace print sql message

func (*Logger) Warn

func (l *Logger) Warn(ctx context.Context, msg string, data ...interface{})

Warn print warn messages

Jump to

Keyboard shortcuts

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