utils

package
v0.0.0-...-58366fd Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorLog

func ErrorLog(args ...interface{})

func ErrorLogf

func ErrorLogf(format string, args ...interface{})

func FataLogf

func FataLogf(format string, args ...interface{})

func FatalLog

func FatalLog(args ...interface{})

func GetDB

func GetDB() (db *gorm.DB, err error)

Using this function to get a connection, you can create your connection pool here.

func InfoLog

func InfoLog(args ...interface{})

func InfoLogf

func InfoLogf(format string, args ...interface{})

func LogFlush

func LogFlush()

func SetConnection

func SetConnection(user string, pass string, host string, port string, name string, log bool)

func SetLogger

func SetLogger(debugLog bool)

func WarningLog

func WarningLog(args ...interface{})

func WarningLogf

func WarningLogf(format string, args ...interface{})

Types

type Backoff

type Backoff struct {
	// contains filtered or unexported fields
}

func NewBackoff

func NewBackoff(method BackoffMethod, mult int, delays []time.Duration, maxAttempt int) (b *Backoff, err error)

func (*Backoff) AttemptAllowed

func (b *Backoff) AttemptAllowed(attempt int) (ok bool)

func (*Backoff) GetDelay

func (b *Backoff) GetDelay(attempt int) (delay time.Duration)

type BackoffMethod

type BackoffMethod uint
const (
	NoAttempt   BackoffMethod = 0
	ConstantBO  BackoffMethod = 1
	GeometricBO BackoffMethod = 2
	ListBO      BackoffMethod = 3
)

type Connection

type Connection struct {
	User    string
	Pass    string
	Host    string
	Port    string
	Name    string
	LogMode bool
}

Jump to

Keyboard shortcuts

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