gotk

package module
v2.4.4 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 13 Imported by: 1

README

GoTK

The awesome GoTK library for Golang, aims to bring developer friendliness to just about every project.

Go Report Card Test Status MIT license Go.Dev reference

Getting Started

Visit GoTK wiki page for more info

License

Released under the MIT License

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JSON jsonEngine

Functions

func Get

func Get[T any](g Getter, key string) (value T, err error)

func IsDir added in v2.4.0

func IsDir(file string) bool

func IsFile added in v2.4.0

func IsFile(file string) bool

func Join added in v2.3.0

func Join[T SetConstraint](entries []T, delim string) (value string, err error)

func ParseJSON

func ParseJSON(data []byte, v any) (err error)

func Path added in v2.4.0

func Path(paths ...string) string

func PathFromExecutable added in v2.4.0

func PathFromExecutable(paths ...string) (file string, err error)

func Split added in v2.3.0

func Split[T SetConstraint](data string, delim string) (value []T, err error)

func ToJSON

func ToJSON(v any) (value []byte, err error)

func UUID

func UUID() (value string, err error)

Types

type Array

type Array[T comparable] interface {
	First() T
	Last() T
	At(i int) T
	Get(i int) T
	Take(i int) T
	Push(v ...T) int
	Pop() T
	Slice(start int, stop ...int) Array[T]
	Splice(offset int, length int, v ...T) Array[T]
	Contains(v T) bool
	IndexOf(v T) int
	Length() int
	Find(fn ArrayPredicate[T]) T
	Filter(fn ArrayPredicate[T]) []T
	ForEach(fn ArrayCallback[T])
}

func NewArray

func NewArray[T comparable](data ...T) Array[T]

type ArrayCallback

type ArrayCallback[T comparable] func(value T, index int)

type ArrayPredicate

type ArrayPredicate[T comparable] func(value T) bool

type Getter

type Getter interface {
	Get(key string) (value any, exists bool)
}

type JSONEngine

type JSONEngine interface {
	Decode(data []byte, v any) (err error)
	Encode(v any) (value []byte, err error)
}

func NewJSON

func NewJSON(validatorTagName ...string) JSONEngine

type PathFn added in v2.4.0

type PathFn func() (path string, err error)

type SetConstraint added in v2.3.0

type SetConstraint interface {
	constraints.Integer | constraints.Float | ~string
}

type Validator

type Validator interface {
	Validate(data any, rules ...any) (err error)
}

func NewValidator

func NewValidator(tagName ...string) Validator

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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