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 ¶
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.
Click to show internal directories.
Click to hide internal directories.