gorm

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package gorm provides an alternative gorm.Model that excludes the time fields from serialization, reducing some API bandwidth usage. There's also a logger with adjusted timing/configuration.

Index

Constants

This section is empty.

Variables

View Source
var (
	DebugLogger = logger.New(log.New(os.Stdout, "\r\n", log.LstdFlags),
		logger.Config{
			SlowThreshold:             200 * time.Millisecond,
			LogLevel:                  logger.Info,
			IgnoreRecordNotFoundError: false,
			Colorful:                  true,
		})

	DefaultLogger = logger.New(log.New(os.Stdout, "\r\n", log.LstdFlags),
		logger.Config{
			SlowThreshold:             200 * time.Millisecond,
			LogLevel:                  logger.Warn,
			IgnoreRecordNotFoundError: true,
			Colorful:                  true,
		})
)

Functions

func Logger

func Logger(v string) logger.Interface

Types

type Model

type Model struct {
	ID        uint        `gorm:"primarykey"`
	CreatedAt time.Time   `json:"-"`
	UpdatedAt time.Time   `json:"-"`
	DeletedAt g.DeletedAt `gorm:"index" json:"-"`
}

gorm model to exclude fields during json seralization. note that gorm uses reflection so fields can be added or removed as needed.

Jump to

Keyboard shortcuts

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