utils

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//GlobalDBVersion ...
	GlobalDBVersion int   = 1
	MT5_MIN_DATE    int64 = 1616111768768
)

Variables

This section is empty.

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, fn OverTransactionAdditionalQueries) error

ExecScript runs que SQL

func NumericHash added in v0.9.2

func NumericHash(ac interface{}) int64

func StructToSlice

func StructToSlice(st interface{}, allFields bool) ([]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

Jump to

Keyboard shortcuts

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