Documentation
¶
Index ¶
- Constants
- Variables
- func FormatValuesInUp(input interface{}, validateNullField ...bool) (cols []string, vals []interface{}, err error)
- func GenerateToken(secret string, ts int64) (otp string, err error)
- func GetUrlQrCode(projectName, otpToken, userName *string) (url string)
- func MakePagination[T any](query *squirrel.SelectBuilder, p *Params) (res []T, next *bool, err error)
- func PanicRecovery(msg interface{}) (err error)
- func Pointer[T any](value T) *T
- func RandomString(length int) string
- func TypeConverter[T any](data any) (*T, error)
- func ValidateToken(token, otp *string) (err error)
- type ErrorGRPC
- func (*ErrorGRPC) Descriptor() ([]byte, []int)deprecated
- func (x *ErrorGRPC) GetCode() uint64
- func (x *ErrorGRPC) GetError() string
- func (x *ErrorGRPC) GetLocation() string
- func (x *ErrorGRPC) GetRawError() string
- func (*ErrorGRPC) ProtoMessage()
- func (x *ErrorGRPC) ProtoReflect() protoreflect.Message
- func (x *ErrorGRPC) Reset()
- func (x *ErrorGRPC) String() string
- type Logger
- func (l *Logger) DPanic(args ...interface{})
- func (l *Logger) DPanicf(template string, args ...interface{})
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Debugf(template string, args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(template string, args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(template string, args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(template string, args ...interface{})
- func (l *Logger) InitLogger()
- func (l *Logger) Panic(args ...interface{})
- func (l *Logger) Panicf(template string, args ...interface{})
- func (l *Logger) Warn(args ...interface{})
- func (l *Logger) Warnf(template string, args ...interface{})
- func (l *Logger) ZapLogger() *zap.Logger
- type NoContent
- type Params
Constants ¶
const ( // MaxLimit defines query max value to field limit MaxLimit uint64 = 100 )
Variables ¶
var File_protos_error_proto protoreflect.FileDescriptor
Functions ¶
func FormatValuesInUp ¶
func FormatValuesInUp(input interface{}, validateNullField ...bool) (cols []string, vals []interface{}, err error)
FormatValuesInUp format columns and values for an insert or update query
func GenerateToken ¶
GenerateToken generate an OTP token
func GetUrlQrCode ¶
GetUrlQrCode returns the url of qr code to configure the otp
func MakePagination ¶
func MakePagination[T any](query *squirrel.SelectBuilder, p *Params) (res []T, next *bool, err error)
MakePagination constructs pagination data for a given database query
func PanicRecovery ¶
func PanicRecovery(msg interface{}) (err error)
PanicRecovery handles recovered panics
func RandomString ¶
RandomString generates a random string of specified length.
The generated string is cryptographically random and matches [A-Za-z0-9]+ (aka. it's transparent to URL-encoding).
func TypeConverter ¶
TypeConverter converts all data to a destination data output.
func ValidateToken ¶
ValidateToken validates if the otp is valid
Types ¶
type ErrorGRPC ¶
type ErrorGRPC struct { Location *string `protobuf:"bytes,1,opt,name=Location,proto3,oneof" json:"Location,omitempty"` RawError *string `protobuf:"bytes,2,opt,name=RawError,proto3,oneof" json:"RawError,omitempty"` Error *string `protobuf:"bytes,3,opt,name=Error,proto3,oneof" json:"Error,omitempty"` Code *uint64 `protobuf:"varint,4,opt,name=Code,proto3,oneof" json:"Code,omitempty"` // contains filtered or unexported fields }
func (*ErrorGRPC) Descriptor
deprecated
func (*ErrorGRPC) GetLocation ¶
func (*ErrorGRPC) GetRawError ¶
func (*ErrorGRPC) ProtoMessage ¶
func (*ErrorGRPC) ProtoMessage()
func (*ErrorGRPC) ProtoReflect ¶
func (x *ErrorGRPC) ProtoReflect() protoreflect.Message
type Params ¶
type Params struct { // Fields returns as request queries Fields []string // Filters returns all filters of a request in map format Filters map[string][]string // Limit limit is used to set the size of a paginated list Limit uint64 // Offset offset is used to determine which page // should be in the paginated list Offset uint64 // Total Total is used to fetch the total // amount of a paginated list Total bool }
Params used for requests when some controls params are allowed
func NewParams ¶
func NewParams() Params
NewParams builds an empty dummy `Params` object for utility usage
func ParseParams ¶
ParseParams receives the gin.Context and parse the query params for the request
func (*Params) ClearFilters ¶
ClearFilters clear the filters from the request params
func (*Params) RemoveFilters ¶
RemoveFilters remove filter values