gorm

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DBType       string
	DSN          string
	MaxLifetime  int
	MaxOpenConns int
	MaxIdleConns int
	TableName    string
}

Config - Configuration parameter

type Hook

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

Hook - Gorm log hook

func New

func New(c *Config) *Hook

New Create a gorm-based hook instance (requires a table name)

func (*Hook) Close

func (h *Hook) Close() error

Close - Close hook

func (*Hook) Exec

func (h *Hook) Exec(entry *logrus.Entry) error

Exec - Execution log write

type LogItem

type LogItem struct {
	ID           uint      `gorm:"column:id;primary_key;auto_increment;"` // id
	Level        string    `gorm:"column:level;size:20;index;"`           // Log level
	Message      string    `gorm:"column:message;size:1024;"`             // Message
	TraceID      string    `gorm:"column:trace_id;size:128;index;"`       // Tracking ID
	UserUUID     string    `gorm:"column:user_uuid;size:36;index;"`       // User ID
	SpanTitle    string    `gorm:"column:span_title;size:256;"`           // Tracking unit title
	SpanFunction string    `gorm:"column:span_function;size:256;"`        // Tracking unit function name
	Data         string    `gorm:"column:data;type:text;"`                // Log data(json)
	Version      string    `gorm:"column:version;index;size:32;"`         // Service version number
	CreatedAt    time.Time `gorm:"column:created_at;index"`               // Creation time
}

LogItem - Store log entries

func (LogItem) TableName

func (LogItem) TableName() string

TableName - Table Name

Jump to

Keyboard shortcuts

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