utils

package
v0.18.3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//GlobalDBVersion ...
	GlobalDBVersion  int = 1
	TickerServerPort     = "TICKER_SERVER_PORT"
	// TickerServerAddress     = "TICKER_SERVER_ADDRESS"
	TickerDatabaseURL = "TICKER_DATABASE_URL"
	TickerConfigLevel = "TICKER_CONFIG_LEVEL"
)

Variables

View Source
var DefaultFieldsToIgnore = []string{"created", "updated", "deleted"}
View Source
var MT5_MIN_DATE = time.Now().UTC().Add(time.Hour * 24 * 18000 * -1).Unix()

Functions

func AsSha256

func AsSha256(o interface{}) string

AsSha256 hash function

func AsSha256OfOrderedMap

func AsSha256OfOrderedMap(o map[string]interface{}, orderedKey []string) string

AsSha256OfOrderedMap hash function My tests showed this is unnecessary because apparently, the order of the key is the same if the content of the row is the same. So, two rows could have different field order, but it should be always the same for the specific row

func CleanAndTrim

func CleanAndTrim(text string) string

CleanAndTrim just alphanumeric chars

func ExecScript

func ExecScript(ctx context.Context, model interface{}, sql string, dbCon *sqlx.DB, ignoreFields []string) (int64, error)

ExecScript runs que SQL

func NumericHash added in v0.9.2

func NumericHash(ac interface{}) int64

func StructToSlice

func StructToSlice(st interface{}, ignoreFields []string) ([]interface{}, []string)

StructToSlice return field name and its values from a struct

Types

type OverTransactionAdditionalQueries

type OverTransactionAdditionalQueries func(con *pgxpool.Conn) error

OverTransactionAdditionalQueries allow you to runs additional taks over the openned transaction

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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