sherbet

package module
v0.4.21 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: MIT Imports: 12 Imported by: 0

README

sherbet

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecrypt added in v0.3.0

func AesDecrypt(crypted, key []byte) ([]byte, error)

AesDecrypt decrypt data

func AesEncrypt added in v0.3.0

func AesEncrypt(data, key []byte) ([]byte, error)

AesEncrypt encrypt data

func CombineErrors added in v0.4.20

func CombineErrors(errs ...error) error

CombineErrors combile errors

func CombineUpdateSetMap

func CombineUpdateSetMap(keys []string, values []any) map[string]any

CombineUpdateSetMap combine two array to a map for update's set method

func DatetimeFormat

func DatetimeFormat(datetime *string, format string) error

DatetimeFormat format a datetime

func DatetimesFormat

func DatetimesFormat(datetimes *[]*string, format string) error

DatetimesFormat format datetimes

func DecryptArrayToInt

func DecryptArrayToInt(data int64, length int) []bool

DecryptArrayToInt decrypt int64 to array

func EncryptArrayToInt

func EncryptArrayToInt(array []bool) int64

EncryptArrayToInt encrypt array to int64

func GetPoint added in v0.4.2

func GetPoint[T string | int | int64 | float64 | bool](obj T) *T

GetPoint get object's point

func GetRandomPassword added in v0.4.13

func GetRandomPassword(length int) string

GetRandomPassword get password

func HasValueFromSlice added in v0.3.0

func HasValueFromSlice[T int | float64](array *[]*T, value *T) (result bool)

HasValueFromSlice has value from slice

func HasValueFromSliceForInt added in v0.2.2

func HasValueFromSliceForInt(array *[]*int, value *int) (result bool)

HasValueFromSliceForInt has value from slice

func HasValueFromSliceForString added in v0.2.2

func HasValueFromSliceForString(array *[]*string, value *string) (result bool)

HasValueFromSliceForString has value from slice

func MysqlDelete added in v0.4.10

func MysqlDelete(
	database *sqlx.DB,
	response **BaseResponse,
	table *string,
	data *map[string]any,
	where *squirrel.And,
)

MysqlDelete delete data from mysql

func MysqlPost added in v0.4.5

func MysqlPost(
	database *sqlx.DB,
	response **BaseResponse,
	table *string,
	columns *[]string,
	values *[]any,
	id *int64,
)

MysqlPost post data to mysql

func MysqlPut added in v0.4.9

func MysqlPut(
	database *sqlx.DB,
	response **BaseResponse,
	table *string,
	data *map[string]any,
	where *squirrel.And,
)

MysqlPut put data from mysql

func MysqlRetrieveDetail added in v0.4.5

func MysqlRetrieveDetail(
	database *sqlx.DB,
	response **BaseResponse,
	table *string,
	fields *[]string,
	where *squirrel.And,
	data any,
)

MysqlRetrieveDetail retrieve detail from mysql

func MysqlRetrieveList added in v0.4.5

func MysqlRetrieveList(
	database *sqlx.DB,
	response **BaseResponse,
	table *string,
	fields *[]string,
	where *squirrel.And,
	orderBy *[]string,
	limit *uint64,
	offset *uint64,
	data any,
)

MysqlRetrieveList retrieve list from mysql

func MysqlRetrieveTotal added in v0.4.5

func MysqlRetrieveTotal(
	database *sqlx.DB,
	response **BaseResponse,
	table *string,
	field *string,
	where *squirrel.And,
	data any,
)

MysqlRetrieveTotal retrieve total from mysql

func PKCS7Padding added in v0.3.0

func PKCS7Padding(text []byte, size int) []byte

PKCS7Padding encrypt bytes

func PKCS7UnPadding added in v0.3.0

func PKCS7UnPadding(data []byte) []byte

PKCS7UnPadding decrypt bytes

func ReflectTags

func ReflectTags(obj any, tag string) *[]string

ReflectTags get object's tags

func ReflectValues

func ReflectValues(obj any) *[]any

ReflectValues get object's value

func ReturnResponse

func ReturnResponse(ctx iris.Context, baseResponse *BaseResponse)

ReturnResponse response get to the client

Types

type BaseResponse

type BaseResponse struct {
	StatusCode int
	Body       *iris.Map
	Error      *error
}

BaseResponse is struct

func BuildResponseBuildSQLWrong

func BuildResponseBuildSQLWrong(err *error) *BaseResponse

BuildResponseBuildSQLWrong return a build sql wrong response

func BuildResponseExecuteSQLWrong

func BuildResponseExecuteSQLWrong(err *error) *BaseResponse

BuildResponseExecuteSQLWrong return a execute sql wrong response

func BuildResponseGet

func BuildResponseGet(body *iris.Map) *BaseResponse

BuildResponseGet return a get response

func BuildResponseParametersWrong

func BuildResponseParametersWrong(err *error) *BaseResponse

BuildResponseParametersWrong return a parameters wrong response

func BuildResponseUnexpectedWrong

func BuildResponseUnexpectedWrong(err *error) *BaseResponse

BuildResponseUnexpectedWrong return a unexpected wrong response

Jump to

Keyboard shortcuts

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