commons

package
v0.0.0-...-537b99d Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Empty       = ""
	EnvVariable = "ENVIRONMENT"
	Ok          = "ok"
	TrackingID  = "TrackingID"
)
View Source
const (
	Dev            = "Dev"
	Qa             = "Qa"
	Prod           = "Prod"
	DevConfigPath  = "config_dev"
	QaConfigPath   = "config_qa"
	ProdConfigPath = "config"
	ConfigDir      = "./config"
)

Config Viper

View Source
const (
	GreenStatus = "green"
	AmberStatus = "amber"
	RedStatus   = "red"
)

Heartbeat Status

View Source
const (
	CandidateColl = "candidates"
	CandidateDb   = "core_db"
)

Mongo

View Source
const InvalidRequestBody = "InvalidRequestBody"
View Source
const InvalidRequestParameter = "InvalidRequestParameter"

Variables

This section is empty.

Functions

func IsEmpty

func IsEmpty(str string) bool

IsEmpty checks for empty string

func MakeResp

func MakeResp(payload interface{}, code string, err error) []byte

MakeResp generates response in slice of byte

func ToString

func ToString(value url.Values) string

func Validate

func Validate(entity interface{}) (bool, error)

func ValidateID

func ValidateID(fctx *FlowContext, id string) ([]string, bool)

ValidateID to validates id

func ValidatePaginationParams

func ValidatePaginationParams(fctx *FlowContext, limit string, offset string) ([]string, bool)

ValidatePaginationParams to validates pagination parameters

Types

type APIError

type APIError struct {
	Code     string
	Message  string
	Metadata interface{}
}

type FlowContext

type FlowContext struct {
	TrackingID string
}

type Response

type Response struct {
	Data  interface{}
	Error *APIError
}

func ToResponse

func ToResponse(payload interface{}, code string, error error) *Response

ToResponse generates standard response

Jump to

Keyboard shortcuts

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