Documentation
¶
Index ¶
- Variables
- func After(d time.Duration) *time.Time
- func CheckCors(origin string, domain string) bool
- func CheckKeys(userRight int64, val func(key string) int64, keys ...string) bool
- func CheckVals(userRight int64, vals ...int64) bool
- func Cors(set func(key string, value string), origin string, allow []string)
- func CreatePrivateKey(privateKeyPEM []byte) (*ecdsa.PrivateKey, error)
- func CreatePrivateKeyPEM() ([]byte, error)
- func CreatePublicKey(publicKeyPEM []byte) (*ecdsa.PublicKey, error)
- func CreatePublicKeyPEM(privateKey *ecdsa.PrivateKey) ([]byte, error)
- func DirExist(dir string) bool
- func FetchFile(url string, dist string) error
- func FileExist(filename string) bool
- func FileSize(size int64) string
- func HomeDir(path string) (string, error)
- func Int(name string, val int) error
- func IsBool(attributeType string) bool
- func IsInt(goType string) bool
- func IsNumeric(attributeType string) bool
- func MakeCamel(val string) string
- func MakeCapitalize(str string) string
- func MakeKebab(val string) string
- func MakePlural(name string) string
- func MakeSafeString(val string) string
- func MakeSingle(name string) string
- func MakeSnake(val string) string
- func MakeStudly(val string) string
- func MakeTitle(val string) string
- func MakeUrl(val string) string
- func MatchAlphabet(val string) bool
- func MatchDomain(val string) bool
- func MatchEmail(val string) bool
- func MatchPhone(val string) bool
- func MySQLSplit(data []byte, atEOF bool) (advance int, token []byte, err error)
- func Now() *time.Time
- func OpenBrowser(url string) error
- func RString(name string, val *string) error
- func RandString(l int) (string, error)
- func RandomString(l int) (string, error)
- func RandomStringWithCharset(l int, characters string) (string, error)
- func ReadJSON(filename string, v interface{}) error
- func ReleaseLexer(lexer *Lexer)
- func SqlFilter(filter string, w io.Writer, args *[]any, prefix string, ...) error
- func SqlOrderBy(orderBy string, w io.Writer, prefix string, ...) error
- func String(name string, val string) error
- func TarFile(src string) (string, error)
- func TryFetchFile(url string, dist string, retry int) error
- func TryParse(val string, attributeType string) (interface{}, error)
- func Uint64(name string, val uint64) error
- func ValidateDomain(domain ...string) error
- func ValidateEmail(email ...string) error
- func ValidateName(name ...string) error
- func ValidatePhone(phone ...string) error
- func Where(where string, fn func(key string, op string, val string))
- func WriteJSON(filename string, v interface{}, overwrite bool) error
- func ZipFile(src string) (string, error)
- type Lexer
- func (l *Lexer) Advance()
- func (l *Lexer) Expect(c byte) error
- func (l *Lexer) Peek() byte
- func (l *Lexer) ReadBool() (bool, error)
- func (l *Lexer) ReadFloatArray() ([]float64, error)
- func (l *Lexer) ReadInt() (int, error)
- func (l *Lexer) ReadString() (string, error)
- func (l *Lexer) SkipValue() error
- func (l *Lexer) SkipWhitespace()
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotVerified data not verified ErrNotVerified = errors.New("data not verified") // ErrEmailNotVerified email not verified ErrEmailNotVerified = errors.New("email not verified") // ErrEmailAddressUsed email address used ErrEmailAddressUsed = errors.New("email address used") // ErrPhoneNotVerified phone not verified ErrPhoneNotVerified = errors.New("phone not verified") // ErrPhoneNumberUsed phone number used ErrPhoneNumberUsed = errors.New("phone number used") // ErrInvalid data invalid ErrInvalid = errors.New("data invalid") // ErrVersionInvalid version invalid ErrVersionInvalid = errors.New("version invalid") // ErrLengthInvalid invalid length ErrLengthInvalid = errors.New("length invalid") // ErrFilterInvalid invalid filter ErrFilterInvalid = errors.New("filter invalid") // ErrOrderByInvalid invalid orderby ErrOrderByInvalid = errors.New("orderby invalid") // ErrEcPublicKeyInvalid ec public key invalid ErrEcPublicKeyInvalid = errors.New("ec public key invalid") // ErrPemBlockInvalid pem block invalid ErrPemBlockInvalid = errors.New("pem block invalid") // ErrCredentialsInvalid login failed, please check your credentials ErrCredentialsInvalid = errors.New("login failed, please check your credentials") )
Functions ¶
func CheckKeys ¶ added in v0.0.3
CheckKeys rbac check right by keys @param val func(key string) get value by key
func Cors ¶ added in v0.0.15
Cors sets the Cors (Cross-Origin Resource Sharing) related HTTP header information
func CreatePrivateKey ¶ added in v0.0.2
func CreatePrivateKey(privateKeyPEM []byte) (*ecdsa.PrivateKey, error)
CreatePrivateKey return *ecdsa.PrivateKey
func CreatePrivateKeyPEM ¶ added in v0.0.2
CreatePrivateKeyPEM create private key pem
func CreatePublicKey ¶ added in v0.0.2
CreatePublicKey return *ecdsa.PublicKey
func CreatePublicKeyPEM ¶ added in v0.0.2
func CreatePublicKeyPEM(privateKey *ecdsa.PrivateKey) ([]byte, error)
CreatePublicKeyPEM create public key pem
func MakeCamel ¶ added in v0.0.2
MakeCamel converts the given val to camel case like: user_key to userKey
func MakeCapitalize ¶ added in v0.0.2
MakeCapitalize change first character to upper
func MakeKebab ¶ added in v0.0.2
MakeKebab converts the given val to kebab case like: UserKey to user-key
func MakePlural ¶ added in v0.0.2
MakePlural convert word to plural
func MakeSafeString ¶ added in v0.0.2
MakeSafeString make string safe for sql
func MakeSingle ¶ added in v0.0.2
MakeSingle convert word to single
func MakeSnake ¶ added in v0.0.2
MakeSnake converts the given val to snake case like: UserKey,userKey to user_key
func MakeStudly ¶ added in v0.0.2
MakeStudly converts the given val to studly case like: user_key, userKey to UserKey
func MakeTitle ¶ added in v0.0.2
MakeTitle converts the given val to title case like: UserKey,userKey to user_key
func MatchAlphabet ¶ added in v0.0.2
MatchAlphabet check alphabet
func MySQLSplit ¶ added in v0.0.2
MySQLSplit split function for the Scanner
func OpenBrowser ¶ added in v0.0.12
OpenBrowser attempts to open the specified URL in the default browser of the user.
func RandomString ¶
RandomString random string with [a-zA-Z0-9]
func RandomStringWithCharset ¶ added in v0.0.7
RandStringWithCharset rand string
func ReleaseLexer ¶ added in v0.0.15
func ReleaseLexer(lexer *Lexer)
func SqlFilter ¶
func SqlFilter(filter string, w io.Writer, args *[]any, prefix string, fn func(key string, val string) (string, interface{}, error)) error
SqlFilter create sql for filter and args
func SqlOrderBy ¶
func SqlOrderBy(orderBy string, w io.Writer, prefix string, fn func(variableName string) (string, string, string, error)) error
SqlOrderBy create sql for order by
func TryFetchFile ¶ added in v0.0.13
TryFetchFile
func ValidateDomain ¶ added in v0.0.2
ValidateDomain validate domain
func ValidateEmail ¶ added in v0.0.2
ValidateEmail validate email
func ValidateName ¶ added in v0.0.2
ValidateName validate name
func ValidatePhone ¶ added in v0.0.2
ValidatePhone validate phone number
Types ¶
type Lexer ¶ added in v0.0.15
type Lexer struct {
// contains filtered or unexported fields
}
func CreateLexer ¶ added in v0.0.15
func (*Lexer) ReadFloatArray ¶ added in v0.0.15
func (*Lexer) ReadString ¶ added in v0.0.15
func (*Lexer) SkipWhitespace ¶ added in v0.0.15
func (l *Lexer) SkipWhitespace()