gg_

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: BSD-3-Clause Imports: 17 Imported by: 12

Documentation

Index

Constants

View Source
const (
	EventOnStartApp = "on_start_app"
	EventOnCloseApp = "on_close_app"
)
View Source
const (
	ModeProduction = "production"
	ModeDebug      = "debug"
)
View Source
const DEF_TEMP = "./_temp"
View Source
const LibVersion = "0.3.1"
View Source
const OS_PATH_SEPARATOR = string(os.PathSeparator)

Variables

View Source
var AppName = "New Application"
View Source
var AppSalt = "this-is-token-to-encrypt"
View Source
var AppVersion = "0.1.0" // change this for a global AppName variable
View Source
var PanicSystemError = errors.New("panic_system_error")

Functions

func Bool added in v0.2.61

func Bool(val interface{}, def bool) bool

func Bytes added in v0.2.61

func Bytes(val interface{}) (response []byte)

func Compare added in v0.2.105

func Compare(item1, item2 interface{}) int

func Decode added in v0.2.103

func Decode(input interface{}, callback func(index int, item map[string]interface{})) (err error)

func Deserialize added in v0.2.111

func Deserialize(source io.Reader, e any) (err error)

func DeserializeBytes added in v0.2.111

func DeserializeBytes(data []byte, e any) (err error)

func Float32 added in v0.2.61

func Float32(val interface{}, def float32) float32

func Float64 added in v0.2.61

func Float64(val interface{}, def float64) float64

func Get added in v0.2.60

func Get(object interface{}, path string) (response interface{})

func GetAt added in v0.2.61

func GetAt(array interface{}, index int, defValue interface{}) (response interface{})

func GetBool added in v0.2.61

func GetBool(object interface{}, path string) bool

func GetBytes added in v0.2.61

func GetBytes(object interface{}, path string) []byte

func GetFloat32 added in v0.2.61

func GetFloat32(object interface{}, path string) float32

func GetFloat64 added in v0.2.61

func GetFloat64(object interface{}, path string) float64

func GetInt added in v0.2.61

func GetInt(object interface{}, path string) int

func GetInt16 added in v0.2.61

func GetInt16(object interface{}, path string) int16

func GetInt32 added in v0.2.61

func GetInt32(object interface{}, path string) int32

func GetInt64 added in v0.2.61

func GetInt64(object interface{}, path string) int64

func GetInt8 added in v0.2.61

func GetInt8(object interface{}, path string) int8

func GetMap added in v0.2.60

func GetMap(object interface{}, path string) map[string]interface{}

func GetString added in v0.2.60

func GetString(object interface{}, path string) string

func GetUint added in v0.2.61

func GetUint(object interface{}, path string) uint

func GetUint16 added in v0.2.61

func GetUint16(object interface{}, path string) uint16

func GetUint32 added in v0.2.61

func GetUint32(object interface{}, path string) uint32

func GetUint64 added in v0.2.61

func GetUint64(object interface{}, path string) uint64

func GetUint8 added in v0.2.61

func GetUint8(object interface{}, path string) uint8

func Int added in v0.2.61

func Int(val interface{}, def int) int

func Int16 added in v0.2.61

func Int16(val interface{}, def int16) int16

func Int32 added in v0.2.61

func Int32(val interface{}, def int32) int32

func Int64 added in v0.2.61

func Int64(val interface{}, def int64) int64

func Int8 added in v0.2.61

func Int8(val interface{}, def int8) int8

func IsASCII added in v0.2.105

func IsASCII(s string) bool

func IsArray added in v0.2.59

func IsArray[T any](val interface{}) (response []T, ok bool)

func IsArrayValue added in v0.2.60

func IsArrayValue(val interface{}) (bool, reflect.Value)

func IsArrayValueNotEmpty added in v0.2.60

func IsArrayValueNotEmpty(array interface{}) (bool, reflect.Value)

func IsEmpty added in v0.2.111

func IsEmpty[T any](t T) bool

func IsGreater added in v0.2.105

func IsGreater(item1, item2 interface{}) bool

func IsHTML added in v0.2.63

func IsHTML(text string) bool

func IsLetter added in v0.2.105

func IsLetter(s string) bool

func IsLetterOrPunct added in v0.2.105

func IsLetterOrPunct(s string) bool

func IsLower added in v0.2.105

func IsLower(item1, item2 interface{}) bool

func IsMap added in v0.2.59

func IsMap[T any](val interface{}) (response map[string]T, ok bool)

func IsMapValue added in v0.2.60

func IsMapValue(val interface{}) (bool, reflect.Value)

func IsMark added in v0.2.105

func IsMark(s string) bool

func IsNil added in v0.2.111

func IsNil[T any](t T) bool

func IsPath added in v0.2.62

func IsPath(path string) bool

IsPath get a string and check if is a valid path

func IsString added in v0.2.60

func IsString(val interface{}) (response string, ok bool)

func IsStringValue added in v0.2.60

func IsStringValue(val interface{}) (bool, reflect.Value)

func IsStructValue added in v0.2.60

func IsStructValue(val interface{}) (bool, reflect.Value)

func IsValidJson added in v0.2.59

func IsValidJson(text string) bool

func IsValidJsonArray added in v0.2.59

func IsValidJsonArray(text string) bool

func IsValidJsonObject added in v0.2.59

func IsValidJsonObject(text string) bool

func Map added in v0.2.60

func Map(val interface{}) (response map[string]interface{})

func Marshal added in v0.2.59

func Marshal(entity interface{}) []byte

func MatchBetween added in v0.2.61

func MatchBetween(text string, offset int, patternStart string, patternEnd string, cutset string) []string

func Merge added in v0.2.61

func Merge(override bool, context ...interface{}) (response map[string]interface{})

func Number added in v0.2.61

func Number(s string, def interface{}) interface{}

func PathAbsolute added in v0.2.105

func PathAbsolute(path string) string

func PathExists added in v0.2.62

func PathExists(path string) (bool, error)

PathExists Check if a path exists and returns a boolean value or an error if access is denied @param "path" the Path to check

func PathIsFile added in v0.2.105

func PathIsFile(path string) bool

func PathIsFileExt added in v0.2.105

func PathIsFileExt(s string) bool

func Quote added in v0.2.59

func Quote(v interface{}) string

func ReadBytesFromFile added in v0.2.59

func ReadBytesFromFile(fileName string) ([]byte, error)

func ReadTextFromFile added in v0.2.59

func ReadTextFromFile(fileName string) (string, error)

func ReaderOf added in v0.2.103

func ReaderOf(input interface{}) (reader io.Reader, err error)

func Recover added in v0.2.25

func Recover(args ...interface{})

func RegexpMatchBetween added in v0.2.61

func RegexpMatchBetween(text string, offset int, patternStart *regexp.Regexp, patternEnd *regexp.Regexp, cutset string) []string

func RegexpMatchIndex added in v0.2.61

func RegexpMatchIndex(text string, regex *regexp.Regexp) [][]int

func ReverseArray added in v0.2.105

func ReverseArray(array interface{})

func Serialize added in v0.2.111

func Serialize(obj interface{}) (response []byte, err error)

func SortAscArray added in v0.2.105

func SortAscArray(array interface{})

func SortAscMap added in v0.2.105

func SortAscMap(data []map[string]interface{}, field string)

func SortDescArray added in v0.2.105

func SortDescArray(array interface{})

func SortDescMap added in v0.2.105

func SortDescMap(data []map[string]interface{}, field string)

func Split added in v0.2.109

func Split(s string, seps string) []string

Split using all rune in a string of separators

func String added in v0.2.59

func String(val interface{}) string

func Stringify added in v0.2.59

func Stringify(entity interface{}) string

func Sub added in v0.2.61

func Sub(s string, start int, end int) string

Sub get a substring @param s string The string @param start int Start index @param end int End index

func Uint added in v0.2.61

func Uint(val interface{}, def uint) uint

func Uint16 added in v0.2.61

func Uint16(val interface{}, def uint16) uint16

func Uint32 added in v0.2.61

func Uint32(val interface{}, def uint32) uint32

func Uint64 added in v0.2.61

func Uint64(val interface{}, def uint64) uint64

func Uint8 added in v0.2.61

func Uint8(val interface{}, def uint8) uint8

func Unmarshal added in v0.2.59

func Unmarshal(input interface{}, entity interface{}) (err error)

func UnmarshalFromFile added in v0.2.59

func UnmarshalFromFile(fileName string, entity interface{}) error

func UnmarshalFromString added in v0.2.59

func UnmarshalFromString(s string, entity interface{}) (err error)

func ValueOf added in v0.2.59

func ValueOf(item interface{}) reflect.Value

func WriteBytesToFile added in v0.2.62

func WriteBytesToFile(data []byte, file string, append bool) (bytes int, err error)

func WriteTextToFile added in v0.2.62

func WriteTextToFile(text, file string, append bool) (bytes int, err error)

Types

type ILogger

type ILogger interface {
	Panic(args ...interface{})
	Error(args ...interface{})
	Warn(args ...interface{})
	Info(args ...interface{})
	Debug(args ...interface{})
	Trace(args ...interface{})
}

type IName added in v0.2.59

type IName interface {
	Name() string
}

type ISerializable added in v0.2.59

type ISerializable interface {
	String() string
	Map() map[string]interface{}
}

type ModelDataWrapper added in v0.2.60

type ModelDataWrapper struct {
	Uid         string                 `json:"uid"`
	Group       string                 `json:"group"`
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Payload     map[string]interface{} `json:"payload"`
	// contains filtered or unexported fields
}

ModelDataWrapper is a serializable object useful for data transport

func NewDataWrapper added in v0.2.60

func NewDataWrapper(data ...interface{}) (instance *ModelDataWrapper)

func (*ModelDataWrapper) Data added in v0.2.60

func (instance *ModelDataWrapper) Data(values ...interface{}) (response map[string]interface{})

func (*ModelDataWrapper) DataJSON added in v0.2.62

func (instance *ModelDataWrapper) DataJSON() (response []string)

DataJSON return wrapped data as an array of JSON "stringify" objects

func (*ModelDataWrapper) DataObjects added in v0.2.62

func (instance *ModelDataWrapper) DataObjects() (response []map[string]interface{})

DataObjects return wrapped data as an array of Map objects

func (*ModelDataWrapper) DataString added in v0.2.62

func (instance *ModelDataWrapper) DataString() (response []string)

DataString return wrapped data as an array of JSON "quoted string" objects

func (*ModelDataWrapper) Error added in v0.2.60

func (instance *ModelDataWrapper) Error() error

func (*ModelDataWrapper) HasError added in v0.2.60

func (instance *ModelDataWrapper) HasError() bool

func (*ModelDataWrapper) Map added in v0.2.60

func (instance *ModelDataWrapper) Map() map[string]interface{}

func (*ModelDataWrapper) Reload added in v0.2.60

func (instance *ModelDataWrapper) Reload(values ...interface{}) *ModelDataWrapper

func (*ModelDataWrapper) SaveToFile added in v0.2.62

func (instance *ModelDataWrapper) SaveToFile(filename string) (err error)

func (*ModelDataWrapper) Source added in v0.2.60

func (instance *ModelDataWrapper) Source() (response []interface{})

Source return original data

func (*ModelDataWrapper) String added in v0.2.60

func (instance *ModelDataWrapper) String() string

Jump to

Keyboard shortcuts

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