database

package
v0.0.0-...-e48215e Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Jitter

func Jitter(delta time.Duration, factor int) func()

Jitter takes a duration <param: delta> and a dividing factor <param: factor> and returns a func that makes the current thread sleep for a random amount in range delta/[1...factor]

Ex: delta: 10s factor: 10 => sleep can be anything from 1 sec to 10 sec.

delta: 10s     factor: 20   => sleep can be anything from .5 sec to 10 sec.
delta: 10s     factor: 100  => sleep can be anything from .1 sec to 10 sec.

Min sleep time is 10MS. We are implementing something similar to equal jitter (as we don't have backoff, there's no memory). But following the philosophy of equal jitter and not allowing a very small sleep time.

func RegisterMigration

func RegisterMigration(migration ...string)

Types

type Instance

type Instance struct {
	Instance *dbutils.Instance
	// contains filtered or unexported fields
}

func New

func New(connString string) (*Instance, error)

func (*Instance) Add

func (i *Instance) Add(query string, data []interface{}, sleepFunc func()) error

Jump to

Keyboard shortcuts

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