Documentation ¶
Index ¶
- Constants
- Variables
- func Bool(val interface{}, def bool) bool
- func Bytes(val interface{}) (response []byte)
- func CapitalizeFirst(text string) string
- func Compare(item1, item2 interface{}) int
- func Decode(input interface{}, callback func(index int, item map[string]interface{})) (err error)
- func Deserialize(source io.Reader, e any) (err error)
- func DeserializeBytes(data []byte, e any) (err error)
- func Float32(val interface{}, def float32) float32
- func Float64(val interface{}, def float64) float64
- func Get(object interface{}, path string) (response interface{})
- func GetAt(array interface{}, index int, defValue interface{}) (response interface{})
- func GetBool(object interface{}, path string) bool
- func GetBytes(object interface{}, path string) []byte
- func GetFloat32(object interface{}, path string) float32
- func GetFloat64(object interface{}, path string) float64
- func GetInt(object interface{}, path string) int
- func GetInt16(object interface{}, path string) int16
- func GetInt32(object interface{}, path string) int32
- func GetInt64(object interface{}, path string) int64
- func GetInt8(object interface{}, path string) int8
- func GetMap(object interface{}, path string) map[string]interface{}
- func GetString(object interface{}, path string) string
- func GetUint(object interface{}, path string) uint
- func GetUint16(object interface{}, path string) uint16
- func GetUint32(object interface{}, path string) uint32
- func GetUint64(object interface{}, path string) uint64
- func GetUint8(object interface{}, path string) uint8
- func IOReadBytesFromFile(fileName string) ([]byte, error)
- func IOReadTextFromFile(fileName string) (string, error)
- func IOReaderOf(input interface{}) (reader io.Reader, err error)
- func IORemove(filenames ...string) (undeleted []string, errs []error)
- func IORemoveSilent(filenames ...string)
- func IOWriteBytesToFile(data []byte, file string, append bool) (bytes int, err error)
- func IOWriteTextToFile(text, file string, append bool) (bytes int, err error)
- func Int(val interface{}, def int) int
- func Int16(val interface{}, def int16) int16
- func Int32(val interface{}, def int32) int32
- func Int64(val interface{}, def int64) int64
- func Int8(val interface{}, def int8) int8
- func IsASCII(s string) bool
- func IsArray[T any](val interface{}) (response []T, ok bool)
- func IsArrayType(value any) bool
- func IsArrayValue(val interface{}) (bool, reflect.Value)
- func IsArrayValueNotEmpty(array interface{}) (bool, reflect.Value)
- func IsEmpty[T any](t T) bool
- func IsGreater(item1, item2 interface{}) bool
- func IsHTML(text string) bool
- func IsLetter(s string) bool
- func IsLetterOrPunct(s string) bool
- func IsLower(item1, item2 interface{}) bool
- func IsMap[T any](val interface{}) (response map[string]T, ok bool)
- func IsMapType(value any) bool
- func IsMapValue(val interface{}) (bool, reflect.Value)
- func IsMark(s string) bool
- func IsNil[T any](t T) bool
- func IsNumType(value any) bool
- func IsPath(path string) bool
- func IsString(val interface{}) (response string, ok bool)
- func IsStringType(value any) bool
- func IsStringValue(val interface{}) (bool, reflect.Value)
- func IsStructValue(val interface{}) (bool, reflect.Value)
- func IsValidJson(text string) bool
- func IsValidJsonArray(text string) bool
- func IsValidJsonObject(text string) bool
- func Lang(code string) string
- func LangName(codeIn string, out ...string) string
- func Map(val interface{}) (response map[string]interface{})
- func Marshal(entity interface{}) []byte
- func MatchBetween(text string, offset int, patternStart string, patternEnd string, cutset string) []string
- func Merge(override bool, context ...interface{}) (response map[string]interface{})
- func MimeTypeGet(filename string) (response string)
- func MimeTypeGetExtensions(mimeType string) (response []string, err error)
- func MimeTypeIsAudio(mimeType string) (response bool)
- func MimeTypeIsAudioFile(filename string) (response bool)
- func MimeTypeIsImage(mimeType string) (response bool)
- func MimeTypeIsImageFile(filename string) (response bool)
- func MimeTypeIsVideo(mimeType string) (response bool)
- func MimeTypeIsVideoFile(filename string) (response bool)
- func Number(s string, def interface{}) interface{}
- func PathAbsolute(path string) string
- func PathAbsolutize(path, root string) string
- func PathChangeFileNameExtension(fromPath, toFileExtension string) string
- func PathConcat(paths ...string) (result string)
- func PathExists(path string) (bool, error)
- func PathIsAbs(path string) bool
- func PathIsFile(path string) bool
- func PathIsFileExt(s string) bool
- func PathIsUrl(path string) bool
- func PathMkdir(path string) (err error)
- func Quote(v interface{}) string
- func Recover(args ...interface{})
- func RegexpMatchBetween(text string, offset int, patternStart *regexp.Regexp, ...) []string
- func RegexpMatchIndex(text string, regex *regexp.Regexp) [][]int
- func ReverseArray(array interface{})
- func Serialize(obj interface{}) (response []byte, err error)
- func ShrinkArray[T any](items []T) (response []T)
- func ShrinkMap[T any](items map[string]T) (response map[string]T)
- func SnakeCase(s string) string
- func SortAscArray(array interface{})
- func SortAscMap(data []map[string]interface{}, field string)
- func SortDescArray(array interface{})
- func SortDescMap(data []map[string]interface{}, field string)
- func Split(s string, seps string) []string
- func String(val interface{}) string
- func Stringify(entity interface{}) string
- func Sub(s string, start int, end int) string
- func Title(s string) string
- func Uint(val interface{}, def uint) uint
- func Uint16(val interface{}, def uint16) uint16
- func Uint32(val interface{}, def uint32) uint32
- func Uint64(val interface{}, def uint64) uint64
- func Uint8(val interface{}, def uint8) uint8
- func Unmarshal(input interface{}, entity interface{}) (err error)
- func UnmarshalFromFile(fileName string, entity interface{}) error
- func UnmarshalFromString(s string, entity interface{}) (err error)
- func ValueOf(item interface{}) reflect.Value
- type ILogger
- type IName
- type ISerializable
- type ModelDataWrapper
- func (instance *ModelDataWrapper) Data(values ...interface{}) (response map[string]interface{})
- func (instance *ModelDataWrapper) DataJSON() (response []string)
- func (instance *ModelDataWrapper) DataObjects() (response []map[string]interface{})
- func (instance *ModelDataWrapper) DataString() (response []string)
- func (instance *ModelDataWrapper) Error() error
- func (instance *ModelDataWrapper) HasError() bool
- func (instance *ModelDataWrapper) Map() map[string]interface{}
- func (instance *ModelDataWrapper) Reload(values ...interface{}) *ModelDataWrapper
- func (instance *ModelDataWrapper) SaveToFile(filename string) (err error)
- func (instance *ModelDataWrapper) Source() (response []interface{})
- func (instance *ModelDataWrapper) String() string
Constants ¶
const ( EventOnStartApp = "on_start_app" EventOnCloseApp = "on_close_app" )
const ( ModeProduction = "production" ModeDebug = "debug" )
const DEF_TEMP = "./_temp"
const DefLang = "en"
const LibVersion = "0.3.11"
const OS_PATH_SEPARATOR = string(os.PathSeparator)
Variables ¶
var AppName = "New Application"
var AppSalt = "this-is-token-to-encrypt"
var AppVersion = "0.1.0" // change this for a global AppName variable
var PanicSystemError = errors.New("panic_system_error")
Functions ¶
func CapitalizeFirst ¶ added in v0.3.5
func DeserializeBytes ¶ added in v0.2.111
func GetAt ¶ added in v0.2.61
func GetAt(array interface{}, index int, defValue interface{}) (response interface{})
func GetFloat32 ¶ added in v0.2.61
func GetFloat64 ¶ added in v0.2.61
func IOReadBytesFromFile ¶ added in v0.3.5
func IOReadTextFromFile ¶ added in v0.3.5
func IOReaderOf ¶ added in v0.3.5
func IORemoveSilent ¶ added in v0.3.5
func IORemoveSilent(filenames ...string)
func IOWriteBytesToFile ¶ added in v0.3.5
func IOWriteTextToFile ¶ added in v0.3.5
func IsArrayType ¶ added in v0.3.2
func IsArrayValue ¶ added in v0.2.60
func IsArrayValueNotEmpty ¶ added in v0.2.60
func IsLetterOrPunct ¶ added in v0.2.105
func IsMapValue ¶ added in v0.2.60
func IsStringType ¶ added in v0.3.2
func IsStringValue ¶ added in v0.2.60
func IsStructValue ¶ added in v0.2.60
func IsValidJson ¶ added in v0.2.59
func IsValidJsonArray ¶ added in v0.2.59
func IsValidJsonObject ¶ added in v0.2.59
func Lang ¶ added in v0.3.5
Lang extracts the ISO 639-1 language code (e.g., "en", "it") from the provided language or locale code string.
func LangName ¶ added in v0.3.5
LangName return ISO language name (i.e. "Italian") from a lang code like "it"
func MatchBetween ¶ added in v0.2.61
func MimeTypeGet ¶ added in v0.3.5
func MimeTypeGetExtensions ¶ added in v0.3.5
func MimeTypeIsAudio ¶ added in v0.3.5
func MimeTypeIsAudioFile ¶ added in v0.3.5
func MimeTypeIsImage ¶ added in v0.3.5
func MimeTypeIsImageFile ¶ added in v0.3.5
func MimeTypeIsVideo ¶ added in v0.3.5
func MimeTypeIsVideoFile ¶ added in v0.3.5
func PathAbsolute ¶ added in v0.2.105
func PathAbsolutize ¶ added in v0.3.5
func PathChangeFileNameExtension ¶ added in v0.3.5
func PathConcat ¶ added in v0.3.5
func PathExists ¶ added in v0.2.62
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 PathIsFileExt ¶ added in v0.2.105
func PathMkdir ¶ added in v0.3.5
PathMkdir Creates a directory and all subdirectories if does not exists
func RegexpMatchBetween ¶ added in v0.2.61
func RegexpMatchIndex ¶ added in v0.2.61
func ReverseArray ¶ added in v0.2.105
func ReverseArray(array interface{})
func ShrinkArray ¶ added in v0.3.2
func ShrinkArray[T any](items []T) (response []T)
func SnakeCase ¶ added in v0.3.5
SnakeCase from "ThisIsAName" to "this_is_a_name". Used to format json field names
func SortAscArray ¶ added in v0.2.105
func SortAscArray(array interface{})
func SortAscMap ¶ added in v0.2.105
func SortDescArray ¶ added in v0.2.105
func SortDescArray(array interface{})
func SortDescMap ¶ added in v0.2.105
func Sub ¶ added in v0.2.61
Sub get a substring @param s string The string @param start int Start index @param end int End index
func UnmarshalFromFile ¶ added in v0.2.59
func UnmarshalFromString ¶ added in v0.2.59
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 ISerializable ¶ added in v0.2.59
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