genericutils

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayFind

func ArrayFind(slice []string, val string) (int, bool)

ArrayFind takes a slice and looks for an element in it. If found it will return it's key, otherwise it will return -1 and a bool of false.

func GenerateNatsResponse

func GenerateNatsResponse(status int, msg *nats.Msg, data interface{}, meta *models.Metadata)

GenerateNatsResponse builds responses for nats requests

func GinGenerateResponse

func GinGenerateResponse(status int, c *gin.Context, data interface{}, meta *models.Metadata)

GinGenerateResponse generates a response for the api

func IndexOfString

func IndexOfString(element string, data []string) int

IndexOfString finds the index of an item in a string array. This is case insensitive and returns -1 if not found

func IsInArray

func IsInArray(slice []string, val string) bool

IsInArray takes a slice and looks for an element in it. If found it will return it's key, otherwise it will return -1 and a bool of false.

func RunTransaction

func RunTransaction(db *gorm.DB, fn txnFunc) error

RunTransaction is a wrapper for a transaction. This automatically re-calls `fn` with the open transaction as an argument as long as the database server asks for the transaction to be retried.

Types

This section is empty.

Jump to

Keyboard shortcuts

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