misc

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RFC3339Milli with milli sec precision
	RFC3339Milli          = "2006-01-02T15:04:05.000Z07:00"
	NOTIMEZONEFORMATPARSE = "2006-01-02T15:04:05"
)

Variables

This section is empty.

Functions

func Assert

func Assert(cond bool)

Assert panics if false

func AssertError

func AssertError(err error)

AssertError panics if error

func Contains

func Contains(in interface{}, elem interface{}) bool

Contains returns true if an element is present in a iteratee. https://github.com/thoas/go-funk

func Copy

func Copy(dst, src interface{})

Copy copies the exported fields from src to dest Used for copying the default transport

func GenerateWriteKey added in v1.1.0

func GenerateWriteKey(payload WriteKeyPayloadT) string

Generate a jwt token

func GetKassetteEventMap

func GetKassetteEventMap(kassetteEvent interface{}) (map[string]interface{}, bool)

GetKassetteEventMap returns the event structure from the client payload

func GetKassetteEventUserID

func GetKassetteEventUserID(eventList []interface{}) (string, bool)

func GetKassetteEventVal

func GetKassetteEventVal(key string, kassetteEvent interface{}) (interface{}, bool)

returns the value corresponding to the key in the message structure

func GetMD5UUID

func GetMD5UUID(str string) (uuid.UUID, error)

GetMD5UUID hashes the given string into md5 and returns it as auuid

func GetStringifiedData

func GetStringifiedData(data interface{}) string

func GetTagName

func GetTagName(id string, names ...string) string

func MapLookup

func MapLookup(mapToLookup map[string]interface{}, keys ...string) interface{}

func ParseKassetteEventBatch

func ParseKassetteEventBatch(eventPayload json.RawMessage) ([]interface{}, bool)

ParseKassetteEventBatch looks for the batch structure inside event

func TailTruncateStr

func TailTruncateStr(str string, count int) string

func TruncateStr

func TruncateStr(str string, limit int) string

func UploadFile added in v1.1.0

func UploadFile(DestDirPath string, file *multipart.FileHeader) (string, error)

Upload a file

Types

type WriteKeyPayloadT added in v1.1.0

type WriteKeyPayloadT struct {
	CustomerName string `json:"customer_name"`
	SecretKey    string `json:"secret_key"`
}

func GetWriteKeyPayload added in v1.1.0

func GetWriteKeyPayload(writeKey string) (WriteKeyPayloadT, error)

func (WriteKeyPayloadT) Combine added in v1.1.0

func (wk WriteKeyPayloadT) Combine() string

Jump to

Keyboard shortcuts

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