Documentation ¶
Index ¶
- Variables
- func DeleteRecordAll(_ testing.TB, db *gorm.DB, tableWhereClauses []string) error
- func IsKeyConflictErr(err error) bool
- func IsRecordNotFoundErr(err error) bool
- func NewDatabase(cfg *config.Config) (*gorm.DB, error)
- func NewTestDatabase(tb testing.TB, migration bool) *gorm.DB
- type Logger
- func (l *Logger) Error(ctx context.Context, s string, i ...interface{})
- func (l *Logger) Info(ctx context.Context, s string, i ...interface{})
- func (l *Logger) LogMode(level glogger.LogLevel) glogger.Interface
- func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l *Logger) Warn(ctx context.Context, s string, i ...interface{})
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("record not found") ErrKeyConflict = errors.New("key conflict") )
Functions ¶
func DeleteRecordAll ¶
func IsKeyConflictErr ¶
func IsRecordNotFoundErr ¶
func NewDatabase ¶
NewDatabase creates a new database with given config
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func NewLogger ¶
func NewLogger(slowThreshold time.Duration, ignoreRecordNotFoundError bool, level zapcore.Level) *Logger
NewLogger returns a new logger for gorm. *zap.SugaredLogger will use from context.Context.
Click to show internal directories.
Click to hide internal directories.