Documentation ¶
Index ¶
- func ArrayDiff(src, compare []string) (diff []string)
- func BuildSearchString(param Param, excludeWhere bool) (string, []interface{})
- func GenerateRandomString(l int) string
- func GenerateUUID() string
- func GetTypeCount(i interface{}) int
- func HTTPRequest(method, url string, bodyIn, bodyOut interface{}, header map[string]string) (err error)
- func LogError(c echo.Context, apiError *ae.ApiError)
- func TxnFinish(tx *sqlx.Tx, err *error)
- func ValidJson(jsonValue json.RawMessage) bool
- type Error
- type Filter
- type Meta
- type Output
- type Pagination
- type Param
- type Search
- type SearchBuilder
- func (s *SearchBuilder) AppendCompare(param, compare string, value interface{})
- func (s *SearchBuilder) AppendIn(param string, value interface{})
- func (s *SearchBuilder) AppendLike(param, value string)
- func (s *SearchBuilder) AppendNull(param string, wantNull bool)
- func (s *SearchBuilder) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayDiff ¶
for each element in 'compare', if NOT in 'src', it will be added to the resulting 'diff' if you want to add from an existing, compared to another list, src => existing; compare => new list if you wnat to delete from to an existing, compared to another list, src => new list; compare => existing
func BuildSearchString ¶
func GenerateRandomString ¶
func GenerateUUID ¶
func GenerateUUID() string
func GetTypeCount ¶
func GetTypeCount(i interface{}) int
func HTTPRequest ¶
func HTTPRequest(method, url string, bodyIn, bodyOut interface{}, header map[string]string) (err error)
a simplified http client to call external http servers, it is designed to fail if the status code is not in the 200's inputs:
method: standard http method, i.e.: POST, GET, PATCH, etc url: the full http url bodyIn: map or struct, this function will json.Marshal it for the body payload, pass in 'nil' if not needed bodyOut: map or *struct, this function will json.Unmarshal the response.Body to this variable headers: map[string]string of headers to add to the request
func ValidJson ¶
func ValidJson(jsonValue json.RawMessage) bool
Types ¶
type Output ¶
type Pagination ¶
type Param ¶
type Search ¶
type Search struct { Filters []Filter `json:"filters"` Pagination Pagination `json:"pagination"` Sort string `json:"sort"` // comma separated string, use a '-' before column name to sort DESC i.e.: id,-name => "SORT BY id ASC, name DESC" }
type SearchBuilder ¶
func (*SearchBuilder) AppendCompare ¶
func (s *SearchBuilder) AppendCompare(param, compare string, value interface{})
func (*SearchBuilder) AppendIn ¶
func (s *SearchBuilder) AppendIn(param string, value interface{})
this will produce a string that represents an "IN" clause as long as the incoming arg 'value' is of type slice or array the output will always be sql string array, most DB engines will deal with the single quotes even if the underlying columns is not a text type []string{1, 2, 3} => IN ('1', '2', '3'), this is what is expected
func (*SearchBuilder) AppendLike ¶
func (s *SearchBuilder) AppendLike(param, value string)
func (*SearchBuilder) AppendNull ¶
func (s *SearchBuilder) AppendNull(param string, wantNull bool)
func (*SearchBuilder) String ¶
func (s *SearchBuilder) String() string