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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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