store

package
v0.0.0-...-bd0fe52 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Reset       = "\033[0m"
	Red         = "\033[31m"
	Green       = "\033[32m"
	Yellow      = "\033[33m"
	Blue        = "\033[34m"
	Magenta     = "\033[35m"
	Cyan        = "\033[36m"
	White       = "\033[37m"
	BlueBold    = "\033[34;1m"
	MagentaBold = "\033[35;1m"
	RedBold     = "\033[31;1m"
	YellowBold  = "\033[33;1m"
)

Colors

View Source
const SchemaDev = "dev"

SchemaDev used for dev

View Source
const SchemaProd = "public"

SchemaProd used for prod

View Source
const SchemaTest = "test"

SchemaTest used for tests

View Source
const SchemaTestAnalyzer = "testanalyzer"

SchemaTestAnalyzer used to test the analyzer

View Source
const SchemaTestAnalyzerDownload = "testanalyzerdownload"

SchemaTestAnalyzerDownload used to test the downloaders

View Source
const SchemaTestController = "testcontroller"

SchemaTestController used to test the dao

View Source
const SchemaTestDao = "testdao"

SchemaTestDao used to test the controller

View Source
const SchemaTestDemoClassifier = "testdemoclassifier"

SchemaTestDemoClassifier used to test the demo classifier

View Source
const SchemaTestModel = "testmodel"

SchemaTestModel used to test the model

View Source
const SchemaTestServer = "testserver"

SchemaTestServer used to test the server

Variables

View Source
var (
	Discard = NewCustomLogger(log.New(ioutil.Discard, "", log.LstdFlags), Config{})
	Default = NewCustomLogger(log.New(os.Stdout, "\r\n", log.LstdFlags), Config{
		SlowThreshold: 1000 * time.Millisecond,
		LogLevel:      logger.Info,
		Colorful:      false,
	})
	Recorder = traceRecorder{Interface: Default, BeginAt: time.Now()}
)

some logger pre-configured

View Source
var ErrRecordNotFound = errors.New("record not found")

ErrRecordNotFound record not found

Functions

func CreateDBInstance

func CreateDBInstance(logDB *custlogger.Logger, schema string) *gorm.DB

CreateDBInstance Création de l'instance de la DB

func GetDB

func GetDB(ctx *gin.Context) *gorm.DB

GetDB récupérer la DB

func GetDBOverride

func GetDBOverride(ctx *gin.Context) *gorm.DB

GetDBOverride récupérer la DB, elle ne sera jamais rollback

func InitDB

func InitDB(reset bool, schema string, logDB *custlogger.Logger) *gorm.DB

InitDB initialisation de la connexion à la DB

func NewCustomLogger

func NewCustomLogger(writer Writer, config Config) logger.Interface

NewCustomLogger creates a new logger

Types

type Config

type Config struct {
	SlowThreshold             time.Duration
	Colorful                  bool
	IgnoreRecordNotFoundError bool
	LogLevel                  logger.LogLevel
}

Config the configuration of the logger

type LogLevel

type LogLevel int

LogLevel level of the log

const (
	Silent LogLevel = iota + 1
	Error
	Warn
	Info
)

differents level of log

type Writer

type Writer interface {
	Printf(string, ...interface{})
}

Writer log writer interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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