utils

package
v0.0.0-...-db524d0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (

	//CurrentVersion  exprt the current application version (Used for Etags)
	CurrentVersion = "0.0.0"
)

Variables

This section is empty.

Functions

func ArrayFromInterface

func ArrayFromInterface(data interface{}) []string

ArrayFromInterface transfor an interface into a Json object

func ArrayFromJSON

func ArrayFromJSON(data io.Reader) []string

ArrayFromJSON Try to parse a json array into a go string array

func ArrayToJSON

func ArrayToJSON(objmap []string) string

ArrayToJSON transfor an array into a json array

func IsLower

func IsLower(s string) bool

IsLower check if a string contain only lower cas characters

func MapFromJSON

func MapFromJSON(data io.Reader) map[string]string

MapFromJSON will decode the key/value pair map

func MapToJSON

func MapToJSON(objmap map[string]string) string

MapToJSON converts a map to a json string

func RemoveDuplicatesFromStringArray

func RemoveDuplicatesFromStringArray(arr []string) []string

RemoveDuplicatesFromStringArray remove duplicate string from array ...

func StringArrayIntersection

func StringArrayIntersection(arr1, arr2 []string) []string

StringArrayIntersection interesection between string arrays

func StringFromJSON

func StringFromJSON(data io.Reader) string

StringFromJSON Convert providing json into string

func StringInArray

func StringInArray(a string, array []string) bool

StringInArray Search if provided string exist in provided array

func StringInterfaceFromJSON

func StringInterfaceFromJSON(data io.Reader) map[string]interface{}

StringInterfaceFromJSON Try to parse a json into map[string]interace{}

func StringInterfaceToJSON

func StringInterfaceToJSON(objmap map[string]interface{}) string

StringInterfaceToJSON convert String interface into Json object

func StringToJSON

func StringToJSON(s string) string

StringToJSON convert provided string into Json object

Types

type AppError

type AppError struct {
	// ID for the error
	ID string `json:"id"`
	// Error's message
	Message string `json:"message"` // Message to be display to the end user without debugging information
	// EgenericErrorModelrror's status code
	StatusCode int `json:"status_code,omitempty"` // The http status code
	// Detail of error
	DetailedError string `json:"detailed_error"` // Internal error string to help the developer
	// Id of the request if exist
	RequestID string `json:"request_id,omitempty"` // The RequestID that's also set in the header
	Where     string `json:"-"`                    // The function where it happened in the form of Struct.Func
	IsOAuth   bool   `json:"is_oauth,omitempty"`   // Whether the error is OAuth specific
	// contains filtered or unexported fields
}

AppError Type used to structure error reporting for popcube chat project. swagger:model genericErrorModel

func AppErrorFromJSON

func AppErrorFromJSON(data io.Reader) *AppError

AppErrorFromJSON will decode the input and return an AppError

func NewAPIError

func NewAPIError(statusCode int, id string, message string) *AppError

NewAPIError is used to generate server errors

func NewLocAppError

func NewLocAppError(where string, id string, params map[string]interface{}, details string) *AppError

NewLocAppError is used to generate server errors

func (*AppError) Error

func (er *AppError) Error() string

Error return a string for AppError Type

func (*AppError) ToJSON

func (er *AppError) ToJSON() string

ToJSON function to transform AppError

type StringArray

type StringArray []string

StringArray Reddefine type []string

type StringInterface

type StringInterface map[string]interface{}

StringInterface Interface for map[string]

type StringMap

type StringMap map[string]string

StringMap Redefine type map[string]string

Jump to

Keyboard shortcuts

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