gotype

package module
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

README

gotype

Documentation

Index

Constants

View Source
const (
	ISO8601N   = `2006-01-02 15:04:05.000000000`
	ISO8601    = `2006-01-02 15:04:05.000`
	SqlDate    = `2006-01-02T15:04:05Z`
	TimeFormat = `2006-01-02 15:04:05`
	DateFormat = `2006-01-02`
)
View Source
const (
	Nanosecond  Duration = 1
	Microsecond          = 1000 * Nanosecond
	Millisecond          = 1000 * Microsecond
	Second               = 1000 * Millisecond
	Minute               = 60 * Second
	Hour                 = 60 * Minute
)
View Source
const (
	KindDirectIface = 1 << 5
)

Variables

View Source
var (
	JsonMarshaler = &Marshaler{
		Type:              "json",
		FormatWithSpaces:  true,
		CascadeOnlyDeep:   true,
		QuotedKey:         true,
		QuotedString:      true,
		ExcludeZeros:      true,
		Space:             []byte(" \t\n\v\f\r"),
		Indent:            []byte("  "),
		Quote:             []byte(`"`),
		Escape:            []byte(`\`),
		ValEnd:            []byte(","),
		KeyEnd:            []byte(":"),
		BlockCommentStart: []byte("/*"),
		BlockCommentEnd:   []byte("*/"),
		LineCommentStart:  []byte("//"),
		LineCommentEnd:    []byte("\n"),
		SliceStart:        []byte("["),
		SliceEnd:          []byte("]"),
		MapStart:          []byte("{"),
		MapEnd:            []byte("}"),
	}
	YamlMarshaler = &Marshaler{
		Type:             "yaml",
		Format:           true,
		FormatWithSpaces: true,
		QuotedSpecial:    true,
		ExcludeZeros:     true,
		Space:            []byte(" \t\v\f\r"),
		Indent:           []byte("  "),
		Quote:            []byte(`"'`),
		Escape:           []byte(`\`),
		KeyEnd:           []byte(":"),
		LineCommentStart: []byte("#"),
		LineCommentEnd:   []byte("\n"),
		SliceItem:        []byte("- "),
		InlineSyntax: &InlineSyntax{
			ValEnd:     []byte(", "),
			SliceStart: []byte("["),
			SliceEnd:   []byte("]"),
			MapStart:   []byte("{"),
			MapEnd:     []byte("}"),
		},
	}
)

Functions

func Abs

func Abs(x float64) float64

Abs returns the absolute value of x

func AbsInt

func AbsInt(x int) int

AbsInt returns the absolute value of x

func AppendBytes added in v0.0.19

func AppendBytes(slices ...[]byte) (bytes []byte)

AppendBytes appends bytes to a byte slice

func CharToByte

func CharToByte(sep string) byte

func CoalesceStrings

func CoalesceStrings(strings ...string) (s string)

CoalesceStrings concatenates a series of strings into one string

func ContainsSpecial added in v0.0.19

func ContainsSpecial(s string) bool

func Copy added in v0.0.19

func Copy[T comparable](s []T) []T

Copy copies the contents of a slice into a new slice at a new mem address and returns the new slice

func CopyBytes added in v0.0.19

func CopyBytes(b []byte) []byte

CopyBytes returns b in a new mem address

func Decode

func Decode(e ENCODING, dest any) int

Decode decodes e to poitner dest and returns the number of bytes decoded

func DeepEqual

func DeepEqual(x any, y any) bool

DeepEqual reports whether x and y are “deeply equal”, as defined by golang reflect package

func Format

func Format(format string, a ...any) string

Format inserts a into string format, similar to fmt.Sprintf TODO: optimize performance with alternative to fmt.Sprintf

func GenError

func GenError(callOffset int, format string, a ...any) error

GenError returns a formatted error message with source of error 'callOffset' indicates proceeding calls where the error orinigated 'callOffset' should be 0 if error occured in call to current function

func GobDecode

func GobDecode(buf []byte, dest any)

GobDecode decodes []byte to a provided dest using golang encoding/gob; dest must be a pointer and match []byte origine type

func GobEncode

func GobEncode(a any) []byte

GobEncode encodes any value to []byte using golang encoding/gob

func In

func In(x any, ys ...any) bool

In evaluates if 'x' is equal to any 'y'

func InBytes added in v0.0.19

func InBytes(a byte, b []byte) bool

func IsJsonable

func IsJsonable(a any) bool

IsJsonable evaluate whether a can be converted to Json

func IsQuote

func IsQuote(b byte) bool

func IsSpecialChar added in v0.0.19

func IsSpecialChar(b byte) bool

func IsWhitespace

func IsWhitespace(b byte) bool

func JoinByteSlices

func JoinByteSlices(sep []byte, bytes [][]byte) []byte

JoinByteSlices concatenates the bytes slices to create a new byte slice; The separator sep is placed between elements in the resulting slice

func JoinBytesSep

func JoinBytesSep(sep byte, bytes ...byte) []byte

JoinBytesSep concatenates the bytes to create a new byte slice; The separator sep is placed between elements in the resulting slice

func JoinStrings

func JoinStrings(strs []string, sep string) string

Join concatenates the elements of its first argument to create a single string. The separator Str sep is placed between elements in the resulting string.

func M

func M() map[string]*reflect.Method

func MatchBytes added in v0.0.19

func MatchBytes(a, b []byte) bool

func MustFloatAdd

func MustFloatAdd(x float64, y float64)

MustFloatAdd panic if x + y exceeds math.MaxFloat64 (positive or negative)

func MustFloatMultiply

func MustFloatMultiply(x float64, y float64)

MustIntMultiply panic if x * y exceeds math.MaxFloat64 (positive or negative)

func MustFloatPow

func MustFloatPow(x float64, y float64)

MustFloatPow panic if x ^ y exceeds math.MaxFloat64 (positive or negative)

func MustIntAdd

func MustIntAdd(x int, y int)

MustIntAdd panic if x + y exceeds math.MaxInt (positive or negative)

func MustIntMultiply

func MustIntMultiply(x int, y int)

MustIntMultiply panic if x * y exceeds math.MaxInt (positive or negative)

func MustIntPow

func MustIntPow(x int, y int)

MustIntPow panic if x ^ y exceeds math.MaxInt (positive or negative)

func ParamError

func ParamError(e string, r any) error

ParamError returns error message for expected and received type differences "[error location]: param type error expected type: 'e' received type: 'r'"

func PrintStats

func PrintStats(a any)

PrintStats prints stats about a to the console, including the line where PrintStats was called, Type, gotype DataType, and value

func RepeatBytes added in v0.0.19

func RepeatBytes(bytes []byte, n int) []byte

RepeatBytes returns a new byte slice consisting of count copies of bytes

func SortByCol

func SortByCol(d [][]string, col int)

func Source

func Source(i int) string

func StringsInStrings

func StringsInStrings(xs []string, ys []string) bool

StringsInStrings evaluates whether all x's exist in y's

func StructTypeMatch added in v0.0.31

func StructTypeMatch(x, y *TYPE, ancestry ...*TYPE) bool

StructTypeMatch compairs the structure of 2 structs

Types

type ARRAY

type ARRAY VALUE

func ArrayOf

func ArrayOf(a any) ARRAY

ArrayOf returns a as gotype ARRAY panics if a is not convertable to array

func NewArray

func NewArray(r *TYPE, size int) ARRAY

func (ARRAY) Bool

func (a ARRAY) Bool() bool

Bool returns gotype ARRAY as bool false if empty, true if a len > 0

func (ARRAY) Bytes

func (a ARRAY) Bytes() []byte

Bytes returns gotype ARRAY as serialized json []byte

func (ARRAY) Encode

func (a ARRAY) Encode() ENCODING

Encode returns a gotype encoding of ARRAY

func (ARRAY) ForEach

func (a ARRAY) ForEach(f func(i int, k string, v VALUE) (brake bool))

ForEach executes function f on each item in ARRAY, note: k equals "" at each item

func (ARRAY) Index

func (a ARRAY) Index(i int) VALUE

Index returns the value found at index i of ARRAY

func (ARRAY) Interface

func (a ARRAY) Interface() any

Interface returns gotype ARRAY as a golang interface{}

func (ARRAY) JSON

func (a ARRAY) JSON() JSON

JSON returns gotype ARRAY as gotype JSON

func (ARRAY) Len

func (a ARRAY) Len() int

Len returns the number of items in ARRAY

func (ARRAY) MAP

func (a ARRAY) MAP() MAP

MAP returns gotype ARRAY as gotype Map

func (ARRAY) Map

func (a ARRAY) Map() map[string]any

Map returns gotype ARRAY as gotype Map

func (ARRAY) Native

func (a ARRAY) Native() any

Native returns gotype ARRAY as a golang any of array

func (ARRAY) Pointer added in v0.0.4

func (a ARRAY) Pointer() unsafe.Pointer

Pointer returns the pointer to gotype ARRAY

func (ARRAY) SLICE

func (a ARRAY) SLICE() SLICE

SLICE returns gotype ARRAY as gotype SLICE

func (ARRAY) Scan

func (a ARRAY) Scan(dest any)

Scan reads the values of ARRAY into the provided destination pointer, the number of elements in dest must be greater than or equal to the number of elements in ARRAY, otherwise Scan will panic

func (ARRAY) Set

func (a ARRAY) Set(i int, v any) ARRAY

Set updates the value at index i to value v, returns the ARRAY with the updated value

func (ARRAY) Slice

func (a ARRAY) Slice() []any

Slice returns gotype ARRAY as []any

func (ARRAY) String

func (a ARRAY) String() string

String returns gotype ARRAY as a serialized json string

func (ARRAY) TYPE added in v0.0.4

func (a ARRAY) TYPE() *TYPE

TYPE returns the TYPE of gotype ARRAY

func (ARRAY) VALUE

func (a ARRAY) VALUE() VALUE

VALUE returns gotype ARRAY as gotype VALUE

type BOOL

type BOOL bool

func (BOOL) BYTES

func (b BOOL) BYTES() BYTES

BYTES returns gotype BOOL as gotype BYTES

func (BOOL) Bool

func (b BOOL) Bool() bool

Bool returns gotype BOOL as bool

func (BOOL) Bytes

func (b BOOL) Bytes() []byte

Bytes returns gotype BOOL as []byte

func (BOOL) Encode

func (b BOOL) Encode() ENCODING

Encode returns a gotype encoding of BOOL

func (BOOL) Float64

func (b BOOL) Float64() float64

Float returns gotype BOOL as float64

func (BOOL) Int

func (b BOOL) Int() int

Int returns gotype BOOL as int

func (BOOL) Interface

func (b BOOL) Interface() any

Interface returns gotype BOOL as a golang interface{}

func (BOOL) Native

func (b BOOL) Native() bool

Natural returns gotype BOOL as a golang bool

func (BOOL) STRING

func (b BOOL) STRING() STRING

STRING returns gotype BOOL as a gotype STRING

func (BOOL) String

func (b BOOL) String() string

String returns gotype BOOL as string

func (BOOL) VALUE

func (b BOOL) VALUE() VALUE

Value returns gotype BOOL as gotype Value

type BYTES

type BYTES []byte

func (BYTES) ARRAY

func (b BYTES) ARRAY() ARRAY

ARRAY returns gotype BYTES as a gotype ARRAY

func (BYTES) BOOL

func (b BYTES) BOOL() BOOL

BOOL returns gotype BYTES as gotype BOOL

func (BYTES) Bool

func (b BYTES) Bool() bool

Bool returns gotype BYTES as bool

func (BYTES) Bytes

func (b BYTES) Bytes() []byte

Bytes returns gotype BYTES as []byte

func (BYTES) CanBool

func (b BYTES) CanBool() bool

CanBool evaluates whether BYTES are bool with a len of 1 and either 0 or 1

func (BYTES) CanFloat

func (b BYTES) CanFloat() bool

func (BYTES) CanInt

func (b BYTES) CanInt() bool

CanInt evaluates whether BYTES can be written as Int, Int8, Int16, Int32 or Int64

func (BYTES) CanString

func (b BYTES) CanString() bool

CanString evaluates whether BYTES can be written as a UTF-8 string

func (BYTES) CanUint

func (b BYTES) CanUint() bool

CanUint evaluates whether BYTES can be written as Uint, Uint8, Uint16, Uint32 or Uint64

func (BYTES) CanUuid

func (b BYTES) CanUuid() bool

CanUuid evaluates whether BYTES can be written as a uuid version 1-5, variant 1

func (BYTES) Encode

func (b BYTES) Encode() []byte

Encode returns a gotype encoding of BOOL

func (BYTES) Escaped added in v0.0.19

func (b BYTES) Escaped(quote byte, esc byte) BYTES

Escaped returns string with quote chars escaped

func (BYTES) FLOAT

func (b BYTES) FLOAT() FLOAT

Float returns gotype BYTES as a gotype FLOAT

func (BYTES) Float64

func (b BYTES) Float64() float64

Float64 returns gotype BYTES as Float64

func (BYTES) INT

func (b BYTES) INT() INT

INT returns gotype BYTES as a gotype INT

func (BYTES) InBytes added in v0.0.19

func (b BYTES) InBytes(bytes ...[]byte) bool

InBytes evaluates if BYTES slice matches any of the bytes slices

func (BYTES) Int

func (b BYTES) Int() int

Int returns gotype BYTES as int

func (BYTES) Interface

func (b BYTES) Interface() any

Interface returns gotype BYTES as a golang interface{}

func (BYTES) JSON

func (b BYTES) JSON() JSON

JSON returns gotype BYTES as gotype JSON

func (BYTES) MustBool

func (b BYTES) MustBool()

MustBool panics for bytes cannot be converted to bool

func (BYTES) MustFloat

func (b BYTES) MustFloat()

MustFloat panics for bytes cannot be converted to float64

func (BYTES) MustInt

func (b BYTES) MustInt()

MustInt panics for bytes cannot be converted to int

func (BYTES) MustString

func (b BYTES) MustString()

MustString panics for bytes cannot be converted to utf8 string

func (BYTES) MustUuid

func (b BYTES) MustUuid()

MustUuid panics for bytes cannot be converted to uuid

func (BYTES) Native

func (b BYTES) Native() []byte

Natural returns gotype BYTES as a golang []byte

func (BYTES) SLICE

func (b BYTES) SLICE() SLICE

SLICE returns gotype BYTES as a gotype SLICE

func (BYTES) STRING

func (b BYTES) STRING() STRING

STRING returns gotype BYTES as a gotype STRING

func (BYTES) String

func (b BYTES) String() string

String returns gotype BYTES as string

func (BYTES) TIME

func (b BYTES) TIME() TIME

TIME returns gotype BYTES as a gotype TIME

func (BYTES) UUID

func (b BYTES) UUID() UUID

UUID returns gotype BYTES as a gotype UUID

func (BYTES) Uint

func (b BYTES) Uint() uint

Uint returns gotype BYTES as uint

func (BYTES) VALUE

func (b BYTES) VALUE() VALUE

Value returns gotype BYTES as gotype VALUE

type Duration

type Duration time.Duration

Duration represents the elapsed time between two Times as an int64 nanosecond count. The representation limits the largest representable duration to approximately 290 years.

func Since

func Since(t TIME) Duration

func (Duration) Hours

func (d Duration) Hours() int

func (Duration) Milliseconds

func (d Duration) Milliseconds() int

func (Duration) Minutes

func (d Duration) Minutes() int

func (Duration) Nanoseconds

func (d Duration) Nanoseconds() int

func (Duration) Native

func (d Duration) Native() time.Duration

func (Duration) Round

func (d Duration) Round(m Duration) Duration

func (Duration) STRING

func (d Duration) STRING() STRING

func (Duration) Seconds

func (d Duration) Seconds() int

func (Duration) String

func (d Duration) String() string

func (Duration) Truncate

func (d Duration) Truncate(m Duration) Duration

type ENCODING

type ENCODING []byte

ENCODING contains a gotype byte encoding for storing to disk or for other future decoding to golang types

func Encode

func Encode(a any) ENCODING

Encode encodes any value to bytes

func EncodeNum

func EncodeNum(n any) ENCODING

EncodeNum returns the byte encoding from a value of a number (eg.int)

func EncodeNumCompressed

func EncodeNumCompressed(i any) ENCODING

EncodeNumCompressed returns the byte encoding from a value of a number compressed to the smallest size repreentation of that number

func (ENCODING) Bytes

func (e ENCODING) Bytes() []byte

Bytes returns encoding in []byte

func (ENCODING) Decode

func (e ENCODING) Decode(dest any) int

Decode decodes encoding and inserts values into pointer dest panics if dest format does not match encoding

func (ENCODING) Decodex

func (e ENCODING) Decodex() decodex

Decodex returns the Value and Kind and number of bytes of an encoding returns structs as []any of the struct values and panics if encoding cannot be decoded (or is corrupt)

func (ENCODING) KIND

func (e ENCODING) KIND() KIND

Kind returns the kind of the encoded value panics if cannot determine kind

func (ENCODING) LenAtLeast

func (e ENCODING) LenAtLeast(l int)

LenAtLeast panics if length of encoding is less than l

func (ENCODING) String

func (e ENCODING) String() string

type FIELD

type FIELD struct {
	// contains filtered or unexported fields
}

func (FIELD) Index

func (f FIELD) Index() int

Index returns the position of FIELD in STRUCT

func (FIELD) Interface

func (f FIELD) Interface() any

Interface returns the Field value as interface{}

func (FIELD) KIND

func (f FIELD) KIND() KIND

Kind returns the gotype Kind of the field

func (FIELD) Name

func (f FIELD) Name() string

Name returns the name of the Field

func (FIELD) Pointer added in v0.0.4

func (f FIELD) Pointer() unsafe.Pointer

Pointer returns the pointer to gotype FIELD

func (FIELD) RawTag

func (f FIELD) RawTag() string

func (FIELD) STRING

func (f FIELD) STRING() STRING

STRING returns the STRING value of the Field

func (FIELD) Set

func (f FIELD) Set(a any) FIELD

func (FIELD) String

func (f FIELD) String() string

String returns the string value of the Field

func (FIELD) SubTag

func (f FIELD) SubTag(tag string, subTag string) string

SubTag returns the value of a given subTag in the given tag SubTag("db","name") returns "colname" from tag `db:"name:'colname'"`

func (FIELD) SubTags

func (f FIELD) SubTags(tag string) map[string]string

SubTags returns a map of key vaue pairs in a given tag in the field

func (FIELD) TYPE added in v0.0.4

func (f FIELD) TYPE() *TYPE

TYPE returns the TYPE of gotype FIELD

func (FIELD) Tag

func (f FIELD) Tag(name string) string

Tag returns the value of the given tag name

func (FIELD) Tags

func (f FIELD) Tags() map[string]string

Tags returns a map of key vaue pairs in the field's tag

func (FIELD) VALUE

func (f FIELD) VALUE() VALUE

Value returns the Field value as Value

func (FIELD) Visible

func (f FIELD) Visible() bool

type FLOAT

type FLOAT float64

func (FLOAT) Abs

func (f FLOAT) Abs() float64

func (FLOAT) Add

func (f FLOAT) Add(val float64) float64

Add increases INT by val, panics if exceeds overflow limit

func (FLOAT) BOOL

func (f FLOAT) BOOL() BOOL

BOOL returns gotype FLOAT as a gotype Bool false if 0, otherwise true

func (FLOAT) Bool

func (f FLOAT) Bool() bool

Bool returns gotype Float as a gotype Bool false if 0, otherwise true

func (FLOAT) Bytes

func (f FLOAT) Bytes() []byte

Bytes returns gotype FLOAT as []byte

func (FLOAT) Divide

func (f FLOAT) Divide(val float64) float64

Divide divides FLOAT by val and returns rounded result

func (FLOAT) Encode

func (f FLOAT) Encode() ENCODING

Encode returns a gotype encoding of FLOAT

func (FLOAT) Float32

func (f FLOAT) Float32() float32

Float32 returns golang float32 of gotype FLOAT

func (FLOAT) Float64

func (f FLOAT) Float64() float64

Float returns gotype Float as a gotype Float

func (FLOAT) INT

func (f FLOAT) INT() INT

INT returns gotype Float as a gotype INT

func (FLOAT) Int

func (f FLOAT) Int() int

Int returns gotype Float as int

func (FLOAT) Interface

func (f FLOAT) Interface() any

Interface returns gotype Float as a golang interface{}

func (FLOAT) IsNegative

func (f FLOAT) IsNegative() bool

func (FLOAT) Mod

func (f FLOAT) Mod(val float64) float64

Mod returns the remainder of FLOAT divided by val

func (FLOAT) Multiply

func (f FLOAT) Multiply(val float64) float64

Multiply mutiplies FLOAT by val, , panics if exceeds overflow limit

func (FLOAT) Native

func (f FLOAT) Native() float64

Natural returns gotype Float as a golang float64

func (FLOAT) Pow

func (f FLOAT) Pow(val float64) float64

Pow returns FLOAT raised to val, panics if exceeds overflow limit

func (FLOAT) STRING

func (f FLOAT) STRING() STRING

Str returns gotype Float as a gotype STRING

func (FLOAT) String

func (f FLOAT) String() string

String returns gotype Float as gotype String

func (FLOAT) Sub

func (f FLOAT) Sub(val float64) float64

Add decreases INT by val, panics if exceeds overflow limit

func (FLOAT) TIME

func (f FLOAT) TIME() TIME

TIME returns gotype Float as gotype TIME using numberic value as unix seconds since Jan 1, 1970

func (FLOAT) UINT

func (f FLOAT) UINT() UINT

UINT returns gotype Float as a gotype UINT

func (FLOAT) Uint

func (f FLOAT) Uint() uint

Uint returns gotype FLOAT as uint

func (FLOAT) VALUE

func (f FLOAT) VALUE() VALUE

VALUE returns gotype Float as gotype VALUE

type FieldType added in v0.0.18

type FieldType struct {
	// contains filtered or unexported fields
}

func (*FieldType) Name added in v0.0.18

func (f *FieldType) Name() string

func (*FieldType) Offset added in v0.0.18

func (f *FieldType) Offset() uintptr

func (*FieldType) String added in v0.0.18

func (f *FieldType) String() string

func (*FieldType) TYPE added in v0.0.18

func (f *FieldType) TYPE() *TYPE

func (*FieldType) Tag added in v0.0.18

func (f *FieldType) Tag() string

func (*FieldType) TagValue added in v0.0.18

func (f *FieldType) TagValue(tag string) string

type Gmap added in v0.0.19

type Gmap []GmapEl

Gmap is in essences an ordered map

func (*Gmap) Del added in v0.0.19

func (g *Gmap) Del(key string)

func (*Gmap) Get added in v0.0.19

func (g *Gmap) Get(key string) (VALUE, bool)

func (*Gmap) Keys added in v0.0.19

func (g *Gmap) Keys() []string

func (*Gmap) Set added in v0.0.19

func (g *Gmap) Set(key string, a any)

func (*Gmap) SortByKeys added in v0.0.19

func (g *Gmap) SortByKeys() *Gmap

func (*Gmap) Values added in v0.0.19

func (g *Gmap) Values() []VALUE

type GmapEl added in v0.0.19

type GmapEl struct {
	Key   string
	Value VALUE
}

type Holiday

type Holiday struct {
	time.Time
	// Name is the common name of the holiday
	Name string
	// Date returns the date of the holiday for year 'y'
	Date func(y int) TIME
}

type Holidays

type Holidays struct {
	List []Holiday
}

func GetUsHolidays

func GetUsHolidays() Holidays

func (*Holidays) IsHoliday

func (h *Holidays) IsHoliday(t TIME) bool

type INT

type INT int

func (INT) Abs

func (i INT) Abs() int

func (INT) Add

func (i INT) Add(val int) int

Add increases INT by val, panics if exceeds overflow limit

func (INT) BOOL

func (i INT) BOOL() BOOL

BOOL returns gotype INT as a gotype Bool false if 0, true if 1, otherwise panics

func (INT) Bool

func (i INT) Bool() bool

Bool returns gotype INT as bool false if 0, true if 1, otherwise panics

func (INT) Bytes

func (i INT) Bytes() []byte

Bytes returns gotype INT as []byte

func (INT) Divide

func (i INT) Divide(val int) int

Divide divides Int by val and returns rounded result

func (INT) Encode

func (i INT) Encode() ENCODING

Encode returns a gotype encoding of INT

func (INT) FLOAT

func (i INT) FLOAT() FLOAT

Float returns gotype Int as a gotype FLOAT

func (INT) Float64

func (i INT) Float64() float64

Float returns gotype Int as float64

func (INT) Int

func (i INT) Int() int

Int returns gotype INT as int

func (INT) Int16

func (i INT) Int16() int16

Int16 returns golang int16 of gotype INT

func (INT) Int32

func (i INT) Int32() int32

Int32 returns golang int32 of gotype INT

func (INT) Int64

func (i INT) Int64() int64

Int16 returns golang int64 of gotype INT

func (INT) Int8

func (i INT) Int8() int8

Int8 returns golang int8 of gotype INT

func (INT) Interface

func (i INT) Interface() any

Interface returns gotype INT as a golang interface{}

func (INT) IsNegative

func (i INT) IsNegative() bool

func (INT) Mod

func (i INT) Mod(val int) int

Mod returns the remainder of INT divided by val

func (INT) Multiply

func (i INT) Multiply(val int) int

Multiply mutiplies Int by val, , panics if exceeds overflow limit

func (INT) Native

func (i INT) Native() int

Natural returns gotype INT as a golang int

func (INT) Pow

func (i INT) Pow(val int) int

Pow returns INT raised to val, panics if exceeds overflow limit

func (INT) STRING

func (i INT) STRING() STRING

Str returns gotype INT as a gotype STRING

func (INT) String

func (i INT) String() string

String returns gotype INT as string

func (INT) Sub

func (i INT) Sub(val int) int

Add decreases INT by val, panics if exceeds overflow limit

func (INT) TIME

func (i INT) TIME() TIME

Time returns gotype Int as gotype TIME using numberic value as unix seconds since Jan 1, 1970

func (INT) Uint

func (i INT) Uint() uint

Uint returns gotype INT as uint

func (INT) Uint16

func (i INT) Uint16() uint16

Uint16 returns gotype INT as uint16

func (INT) Uint32

func (i INT) Uint32() uint32

Uint32 returns gotype INT as uint32

func (INT) Uint64

func (i INT) Uint64() uint64

Uint64 returns gotype INT as uint64

func (INT) Uint8

func (i INT) Uint8() uint8

Uint8 returns gotype INT as uint8

func (INT) VALUE

func (i INT) VALUE() VALUE

Value returns gotype Int as gotype Value

type Imethod

type Imethod struct {
	// contains filtered or unexported fields
}

type InlineSyntax added in v0.0.19

type InlineSyntax struct {
	ValEnd     []byte // the characters that separate values
	SliceStart []byte // the characters that start a slice or array
	SliceEnd   []byte // the characters that end a slice or array
	MapStart   []byte // the characters that start a hash map
	MapEnd     []byte // the characters that end a hash map
}

type JSON

type JSON []byte

func JsonOf

func JsonOf(a any) JSON

JsonOf returns 'a' as a gotype Json panics if cannot convert 'a' to Json

func (JSON) ARRAY

func (j JSON) ARRAY() ARRAY

ARRAY returns gotype JSON as gotype ARRAY

func (JSON) Bool

func (j JSON) Bool() bool

Bool returns gotype JSON as bool false if empty, true if a len > 0

func (JSON) Bytes

func (j JSON) Bytes() []byte

Bytes returns gotype JSON as []byte

func (JSON) Empty

func (j JSON) Empty() bool

Empty evaluates whether the JSON holds any values

func (JSON) Format

func (j JSON) Format(indent int, breakList ...bool) string

Format retenders JSON as string with line breaks and indents, indents representing the number of spaces per indent and breaking each element in a list onto its own line if breakList is true

func (JSON) Interface

func (j JSON) Interface() any

Interface returns gotype JSON as a golang interface{}

func (JSON) MAP

func (j JSON) MAP() MAP

MAP returns gotype JSON as MAP

func (JSON) Map

func (j JSON) Map() map[string]any

Map returns gotype JSON as map[string]string

func (JSON) Native

func (j JSON) Native() []byte

Natural returns underlyding value of gotype JSON as a golang interface{}

func (JSON) SLICE

func (j JSON) SLICE() SLICE

SLICE returns gotype JSON as gotype SLICE

func (JSON) STRING

func (j JSON) STRING() STRING

func (JSON) Scan

func (j JSON) Scan(dest any, tags ...string)

Scan reads gotype JSON into the struct provided if tag is empty, Field names will be used to read JSON keys into dest Struct

func (JSON) Slice

func (j JSON) Slice() []any

Slice returns gotype JSON as []string

func (JSON) String

func (j JSON) String() string

String returns gotype JSON as string

func (JSON) Unmarshal added in v0.0.19

func (j JSON) Unmarshal() (object map[string]any, list []any)

Unserialize converts a gotype serialized JSON object to a map or slice, respectively

func (JSON) VALUE

func (j JSON) VALUE() VALUE

Value returns gotype JSON as gotype VALUE

type KIND

type KIND uint8
const (
	Invalid KIND = iota
	Bool
	Int
	Int8
	Int16
	Int32
	Int64
	Uint
	Uint8
	Uint16
	Uint32
	Uint64
	Uintptr
	Float32
	Float64
	Complex64
	Complex128
	Array
	Chan
	Func
	Interface
	Map
	Pointer
	Slice
	String
	Struct
	UnsafePointer
	Field
	Time
	Uuid
	Bytes
)

func KindOf

func KindOf(a any) KIND

func (KIND) Byte

func (k KIND) Byte() byte

func (KIND) CanNil

func (k KIND) CanNil() bool

func (KIND) IsBasic

func (k KIND) IsBasic() bool

func (KIND) IsData added in v0.0.19

func (k KIND) IsData() bool

func (KIND) IsNumeric

func (k KIND) IsNumeric() bool

func (KIND) NewArray

func (k KIND) NewArray(size int) ARRAY

func (KIND) NewMap

func (k KIND) NewMap() MAP

func (KIND) NewSlice

func (k KIND) NewSlice(size int) SLICE

func (KIND) NewValue

func (k KIND) NewValue() VALUE

func (KIND) STRING

func (k KIND) STRING() STRING

func (KIND) Size

func (k KIND) Size() uintptr

func (KIND) String

func (k KIND) String() string

type Location

type Location time.Location

Location maps time instants to the zone in use at that time. Typically, the Location represents the collection of time offsets in use in a geographical area. For many Locations the time offset varies depending on whether daylight savings time is in use at the time instant.

func (Location) Native

func (l Location) Native() time.Location

func (Location) STRING

func (l Location) STRING() STRING

func (Location) String

func (l Location) String() string

type MAP

type MAP VALUE

func MapOf

func MapOf(a any) MAP

MapOf returns a as gotype MAP panics if a is not convertable to map

func (MAP) ARRAY

func (m MAP) ARRAY() ARRAY

ARRAY returns the values of a gotype MAP as gotype ARRAY

func (MAP) Bool

func (m MAP) Bool() bool

Bool returns gotype MAP as bool false if empty, true if a len > 0

func (MAP) Bytes

func (m MAP) Bytes() []byte

Bytes returns gotype MAP as serialized json []byte

func (MAP) Delete

func (m MAP) Delete(key string) MAP

Delete removes key from MAP

func (MAP) Encode

func (m MAP) Encode() ENCODING

Bytes encodes gotype MAP as []byte

func (MAP) ForEach

func (m MAP) ForEach(f func(i int, k string, v VALUE) (brake bool))

ForEach executes function f on each item in ARRAY, note: i is not a fixed value and may change across items

func (MAP) Gmap added in v0.0.19

func (m MAP) Gmap() Gmap

Gmap returns gotype MAP as gotype Gmap

func (MAP) Index

func (m MAP) Index(k string) VALUE

Index returns the value found at key k of Map returns nil pointer if key does not exist

func (MAP) Interface

func (m MAP) Interface() any

Interface returns gotype MAP as a golang interface{}

func (MAP) JSON

func (m MAP) JSON() JSON

JSON returns gotype MAP as gotype JSON

func (MAP) KIND

func (m MAP) KIND() KIND

Kind returns the kind of the map elements

func (MAP) KeyPtr

func (m MAP) KeyPtr(key string) unsafe.Pointer

KeyPtr returns an unsafe pointer to the value at index 'key'

func (MAP) Keys

func (m MAP) Keys() []string

Keys returns gotype MAP keys as []string

func (MAP) Len

func (m MAP) Len() int

Len returns the number of items in MAP

func (MAP) Map

func (m MAP) Map() map[string]any

Map returns gotype MAP as map[string]any

func (MAP) MapValues

func (m MAP) MapValues() map[string]VALUE

MapValues returns gotype MAP as a map[string]VALUE

func (MAP) Native

func (m MAP) Native() any

Native returns gotype MAP as a golang any

func (MAP) Pointer added in v0.0.4

func (m MAP) Pointer() unsafe.Pointer

Pointer returns the pointer to gotype MAP

func (MAP) SLICE

func (m MAP) SLICE() SLICE

SLICE returns gotype MAP values as gotype SLICE

func (MAP) STRING

func (m MAP) STRING() STRING

STRING returns gotype MAP as a gotype STRING

func (MAP) STRUCT

func (m MAP) STRUCT() STRUCT

Struct returns gotype MAP scanned into gotype Struct

func (MAP) Scan

func (m MAP) Scan(dest any, tags ...string)

Scan reads gotype MAP into the struct pointer dest, if tag is empty, Field names will be used to read Map keys into Struct

func (MAP) Set

func (m MAP) Set(k string, v any) MAP

Set updates the value of key k to value v, returns the MAP with the updated value

func (MAP) Slice

func (m MAP) Slice() []any

Slice returns gotype MAP values as []any

func (MAP) String

func (m MAP) String() string

String returns gotype MAP as a serialized json string

func (MAP) Strings

func (m MAP) Strings() []string

Strings returns gotype MAP values as []string

func (MAP) StructTagged

func (m MAP) StructTagged(tag string) STRUCT

StructTagged returns gotype MAP scanned into gotype Struct with keys as tags with the tag lable provieded

func (MAP) TYPE added in v0.0.4

func (m MAP) TYPE() *TYPE

TYPE returns the TYPE of gotype MAP

func (MAP) VALUE

func (m MAP) VALUE() VALUE

VALUE returns gotype MAP as gotype VALUE

func (MAP) Values

func (m MAP) Values() []VALUE

Values returns gotype MAP values as []VALUE

type Marshaler added in v0.0.31

type Marshaler struct {

	// marshaling syntax
	Type              string // the type of marshaller. json, yaml, etc.
	Space             []byte // the space characters
	LineBreak         []byte // the line break characters
	Indent            []byte // the indentation characters
	Quote             []byte // the quote characters, first is default, additional are alternate
	Escape            []byte // the escape characters for string special char escape
	Null              []byte // the null value
	ValEnd            []byte // the characters that separate values
	KeyEnd            []byte // the characters that separate keys and values
	BlockCommentStart []byte // the characters that start a block comment
	BlockCommentEnd   []byte // the characters that end a block comment
	LineCommentStart  []byte // the characters that start a single line comment
	LineCommentEnd    []byte // the characters that end a single line comment
	SliceStart        []byte // the characters that start a slice or array
	SliceEnd          []byte // the characters that end a slice or array
	SliceItem         []byte // the characters before each slice element
	MapStart          []byte // the characters that start a hash map
	MapEnd            []byte // the characters that end a hash map
	InlineSyntax      *InlineSyntax
	// marshaling flags
	Format           bool // when true, marshal with formatting, indentation, and line breaks
	FormatWithSpaces bool // when true, marshal with space between keys and values
	CascadeOnlyDeep  bool // when true, marshal single-depth slices and maps with inline syntax
	QuotedKey        bool // when true, marshal map keys with quotes
	QuotedString     bool // when true, marshal strings with quotes
	QuotedSpecial    bool // when true, marshal strings with quotes if they contain special characters
	QuotedNum        bool // when true, marshal numbers with quotes
	QuotedBool       bool // when true, marshal bools with quotes
	QuotedNull       bool // when true, marshal null with quotes
	RecursiveName    bool // when true, include name, string or type of recursive value in marshalling, otherwise, exclude all recursion
	UnmarshalTyped   bool // when true, unmarshal to typed values (int, float64, bool, string) instead of just strings
	MarshalMethods   bool // when true, marshal structs with a Marshal method by calling the method
	ExcludeZeros     bool // when true, exclude zero and nil values from marshalling
	// contains filtered or unexported fields
}

func (*Marshaler) Buffer added in v0.0.31

func (m *Marshaler) Buffer() []byte

func (*Marshaler) Byte added in v0.0.31

func (m *Marshaler) Byte() byte

func (*Marshaler) ByteIs added in v0.0.31

func (m *Marshaler) ByteIs(b byte) bool

func (Marshaler) Bytes added in v0.0.31

func (m Marshaler) Bytes() []byte

func (*Marshaler) CurIndent added in v0.0.31

func (m *Marshaler) CurIndent() int

func (*Marshaler) Cursor added in v0.0.31

func (m *Marshaler) Cursor() int

func (Marshaler) Formatted added in v0.0.31

func (m Marshaler) Formatted(indent ...int) string

func (*Marshaler) Inc added in v0.0.31

func (m *Marshaler) Inc(i ...int)

func (*Marshaler) IncDepth added in v0.0.31

func (m *Marshaler) IncDepth()

func (*Marshaler) Init added in v0.0.31

func (m *Marshaler) Init()

func (*Marshaler) Len added in v0.0.31

func (m *Marshaler) Len() int

func (Marshaler) Map added in v0.0.31

func (m Marshaler) Map() map[string]any

func (*Marshaler) Marshal added in v0.0.31

func (m *Marshaler) Marshal(a any) *Marshaler

func (*Marshaler) New added in v0.0.31

func (m *Marshaler) New() *Marshaler

func (*Marshaler) Reset added in v0.0.31

func (m *Marshaler) Reset()

func (*Marshaler) ResetCursor added in v0.0.31

func (m *Marshaler) ResetCursor()

func (*Marshaler) SetBuffer added in v0.0.31

func (m *Marshaler) SetBuffer(b []byte)

first arg should be the buffer to append, or not, to replace the buffer

func (Marshaler) Slice added in v0.0.31

func (m Marshaler) Slice() []any

func (Marshaler) String added in v0.0.31

func (m Marshaler) String() string

func (*Marshaler) Unmarshal added in v0.0.31

func (m *Marshaler) Unmarshal(bytes ...[]byte) *Marshaler

func (*Marshaler) UnmarshalTo added in v0.0.31

func (m *Marshaler) UnmarshalTo(stop []byte) []byte

func (*Marshaler) Value added in v0.0.31

func (m *Marshaler) Value() any

type Month

type Month int

Month specifies a month of the year (January = 1, ...).

const (
	January Month = iota + 1
	February
	March
	April
	May
	June
	July
	August
	September
	October
	November
	December
)

type SLICE

type SLICE VALUE

func NewSlice

func NewSlice(r *TYPE, size int) SLICE

func SliceOf

func SliceOf(a any) SLICE

SliceOf returns a as gotype SLICE panics if a is not convertable to slice

func (SLICE) ARRAY

func (s SLICE) ARRAY() ARRAY

ARRAY reutrns gotype SLICE as gotype ARRAY

func (SLICE) Append

func (s SLICE) Append(x ...any) SLICE

Append adds x values to the end of an existing SLICE panics x does not match slice type

func (SLICE) Bool

func (s SLICE) Bool() bool

Bool returns gotype SLICE as bool false if empty, true if a len > 0

func (SLICE) Bytes

func (s SLICE) Bytes() []byte

Bytes returns gotype SLICE as JSON []byte

func (SLICE) Encode

func (s SLICE) Encode() ENCODING

Encode returns a gotype encoding of SLICE

func (SLICE) Extend

func (s SLICE) Extend(n int) SLICE

func (SLICE) Floats

func (s SLICE) Floats() []float64

Floats returns SLICE as []float panics if cannot convert an element to float

func (SLICE) ForEach

func (s SLICE) ForEach(f func(i int, k string, v VALUE) (brake bool))

ForEach executes function f on each item in SLICE, note: k equals "" at each item

func (SLICE) Index

func (s SLICE) Index(i int) VALUE

Index returns the value found at index i of SLICE

func (SLICE) Interface

func (s SLICE) Interface() any

Interface returns gotype SLICE as a golang interface{}

func (SLICE) Ints

func (s SLICE) Ints() []int

Ints returns SLICE as []int panics if cannot convert an element to int

func (SLICE) JSON

func (s SLICE) JSON() JSON

JSON returns gotype SLICE as gotype JSON

func (SLICE) Len

func (s SLICE) Len() int

Len returns the number of items in SLICE

func (SLICE) MAP

func (s SLICE) MAP() MAP

MAP returns gotype SLICE as gotype Map

func (SLICE) Map

func (s SLICE) Map() map[string]any

Map returns gotype SLICE as gotype Map

func (SLICE) MapKeys

func (s SLICE) MapKeys(keys []string) (m map[string]any)

MapKeys returns a Map of the values of SLICE mapped to keys in the provided SLICE

func (SLICE) MapKeysMap

func (s SLICE) MapKeysMap(keys []string) MAP

MapKeys returns a Map of the values of SLICE mapped to keys in the provided SLICE

func (SLICE) MapValues

func (s SLICE) MapValues(values SLICE) (m map[string]any)

MapValues returns a Map of SLICE as keys mapped to values in the provided SLICE

func (SLICE) MapValuesMap

func (s SLICE) MapValuesMap(values SLICE) MAP

MapValues returns a Map of SLICE as keys mapped to values in the provided SLICE

func (SLICE) Native

func (s SLICE) Native() any

Native returns gotype SLICE as a golang any of slice

func (SLICE) Pointer added in v0.0.4

func (s SLICE) Pointer() unsafe.Pointer

Pointer returns the pointer to gotype SLICE

func (SLICE) Scan

func (s SLICE) Scan(dest any)

Scan reads the values of SLICE into the provided destination pointer, the number of elements in dest must be greater than or equal to the number of elements in SLICE, otherwise Scan will panic

func (SLICE) ScanList

func (s SLICE) ScanList(dest any, tags ...string)

ScanList reads values of a SLICE of data records into the provided destination pointer of a list of structs, or struct pointer

func (SLICE) Set

func (s SLICE) Set(i int, v any) SLICE

Set updates the value at index i to value v, returns the SLICE with the updated value

func (SLICE) Slice

func (s SLICE) Slice() []any

Slice returns gotype SLICE as []any

func (SLICE) SortComplex

func (A SLICE) SortComplex() []any

SortComplex sorts SLICE in progressive order of numbers, time and strings while keeping DataTypes consistent NOTE: this sort is resource intensive, use DataType specific sort for less costly sorting

func (SLICE) SortFloats

func (s SLICE) SortFloats() []float64

SortFloats sorts SLICE by first converting all values to float and then returning a new []float64 in sort order

func (SLICE) SortInts

func (s SLICE) SortInts() []int

SortInts sorts SLICE by first converting all values to int and then returning a new []int in sort order

func (SLICE) SortStrings

func (s SLICE) SortStrings() []string

SortStrs sorts SLICE by first converting all values to string and then returning a new []string in sort order

func (SLICE) String

func (s SLICE) String() string

String returns gotype SLICE as a serialized json string

func (SLICE) Strings

func (s SLICE) Strings() []string

Strings returns SLICE as []string panics if cannot convert an element to string

func (SLICE) TYPE added in v0.0.4

func (s SLICE) TYPE() *TYPE

TYPE returns the TYPE of gotype SLICE

func (SLICE) VALUE

func (s SLICE) VALUE() VALUE

VALUE returns gotype SLICE as gotype VALUE

func (SLICE) Values

func (s SLICE) Values() []VALUE

Values returns SLICE as []Value panics if cannot convert an element to Value

type STRING

type STRING string

func (STRING) BOOL

func (s STRING) BOOL() BOOL

BOOL returns gotype STRING as a gotype BOOL

func (STRING) Bool

func (s STRING) Bool() bool

Bool returns gotype STRING as Bool

func (STRING) Bytes

func (s STRING) Bytes() []byte

Bytes returns gotype STRING as gotype Bytes

func (STRING) CanParseFloat

func (s STRING) CanParseFloat() (float float64, can bool, err error)

CanFloat evaluates whether STRING can be parsed to Float (parses commas and converts parenthesis to negative num) returns gotype STRING as float64

func (STRING) CanTime

func (s STRING) CanTime() (t TIME, can bool, err error)

CanTime evaluates whether STRING can convert to Time returns gotype STRING as gotype Time panics if STRING is not formatted as date or time

func (STRING) Contains

func (s STRING) Contains(substr string) bool

Contains evaluates whether string contains substr

func (STRING) ContainsAny

func (s STRING) ContainsAny(chars string) bool

ContainsAny evaluates whether stromg contains any char in chars

func (STRING) Count

func (s STRING) Count(substr string) int

ContainsAny evaluates whether string contains any char in chars

func (STRING) Encode

func (s STRING) Encode() ENCODING

Encode returns a gotype encoding of STRING

func (STRING) Escaped

func (s STRING) Escaped(quote string, esc string) string

Escaped returns string with quote chars escaped

func (STRING) EscapedSplit

func (s STRING) EscapedSplit(sep string) []string

EscapedSplit splits string 's' into []string of substrings between 'sep', unless 'sep' is contained within quotes in string 's'

func (STRING) FLOAT

func (s STRING) FLOAT() FLOAT

FLOAT returns gotype STRING as a gotype FLOAT

func (STRING) Float64

func (s STRING) Float64() float64

Float64 returns gotype STRING as gotype Float64

func (STRING) GetSerialValue

func (s STRING) GetSerialValue(key string, kvSep string, itemSep string) (string, bool)

func (STRING) INT

func (s STRING) INT() INT

INT returns gotype STRING as a gotype INT

func (STRING) InStrings

func (s STRING) InStrings(xs []string) bool

InStrings evaluates if string is list of strings

func (STRING) Index

func (s STRING) Index(i int) VALUE

Index returns the char VALUE at index i of the string

func (STRING) IndexOf

func (s STRING) IndexOf(substr string) int

IndexOf returns the index of the first instance of substr or -1 if substr is not present in string

func (STRING) IndexOfAny

func (s STRING) IndexOfAny(chars string) int

IndexOfAny returns the index of the first instance of any char in chars or -1 if substr is not present in string

func (STRING) Int

func (s STRING) Int() int

Int returns gotype STRING as gotype Int

func (STRING) Interface

func (s STRING) Interface() any

Interface returns gotype STRING as a golang interface{}

func (STRING) JSON

func (s STRING) JSON() JSON

JSON returns gotype STRING as gotype JSON

func (STRING) LastIndexOf

func (s STRING) LastIndexOf(substr string) int

LastIndexOf returns the index of the last instance of substr or -1 if substr is not present in string

func (STRING) LastIndexOfAny

func (s STRING) LastIndexOfAny(chars string) int

LastIndexOfAny returns the index of the last instance of any char in chars or -1 if substr is not present in string

func (STRING) Len

func (s STRING) Len() int

Len return the number of chars in string

func (STRING) Native

func (s STRING) Native() string

Native returns gotype STRING as a golang string

func (STRING) ParseFloat

func (s STRING) ParseFloat() float64

Float returns gotype STRING as a gotype Float (parses commas and converts parenthesis to negative num)

func (STRING) ParseTime

func (s STRING) ParseTime() TIME

Time returns gotype STRING as gotype Time panics if STRING is not formatted as date or time: 2006-01-02 [15:04:05.000]

func (STRING) RegexFind

func (s STRING) RegexFind(regex string, N int) []string

RegexFind slices string into substrings that match the regex, up to N number of matches in string (or all if N < 0), and returns a slice of the substrings of those regex matches

func (STRING) RegexMatch

func (s STRING) RegexMatch(regex string) bool

RegexMatch evaluates whether string contains any match of the regex

func (STRING) RegexReplace

func (s STRING) RegexReplace(regex string, repl string, N int) string

RegexReplace replaces all matches of regex in string with repl, up to N number of matches in string (or all if N < 0), and returns new Str containing replacements

func (STRING) RegexSplit

func (s STRING) RegexSplit(regex string, N int) []string

RegexSplit slices Str into substrings separated by the regex, up to N number of occurances of regex matched in string (or all if N < 0) and returns a slice of the substrings between (and not including) those regex matches

func (STRING) RemoveWhitespace

func (s STRING) RemoveWhitespace() (string, error)

RemoveWhitespace removes all spaces and breaks in Str not contained within quotes returns error if no all quotes are paired

func (STRING) Repeat

func (s STRING) Repeat(N int) string

Repeat returns Str releated N times as one string

func (STRING) Replace

func (s STRING) Replace(old string, new string, N int) string

Replace replaces all matches of old in string with new, up to N number of matches in string (or all if N < 0), and returns new string containing replacements

func (STRING) SLICE

func (s STRING) SLICE() SLICE

SLICE returns gotype STRING as gotype SLICE

func (STRING) STRING

func (s STRING) STRING() STRING

STRING returns gotype STRING as a gotype STRING

func (STRING) SetIndex

func (s STRING) SetIndex(i int, c string) string

func (STRING) Slice

func (s STRING) Slice() []any

Slice returns gotype STRING as []any

func (STRING) Split

func (s STRING) Split(sep string, N int) []string

Split slices string into substrings separated by sep, up to N number of occurances of sep matched in string (or all if N < 0) and returns a slice of the substrings between (and not including) those sep matches

func (STRING) String

func (s STRING) String() string

String returns gotype STRING as golang string

func (STRING) Strings

func (s STRING) Strings() []string

Strings returns gotype STRING as []string

func (STRING) TIME

func (s STRING) TIME() TIME

Time returns gotype STRING as gotype Time panics if STRING is not formatted as date or time: 2006-01-02 [15:04:05.000]

func (STRING) ToCamel

func (s STRING) ToCamel() string

ToCamel converts STRING example_string to camel case format exampleStr

func (STRING) ToLower

func (s STRING) ToLower() string

ToLower returns s with all Unicode letters mapped to their lower case

func (STRING) ToPascal

func (s STRING) ToPascal() string

ToPascal converts STRING example_string to pascal case format ExampleString

func (STRING) ToPhrase

func (s STRING) ToPhrase(c bool) string

ToPhrase converts STRING exampleString to phrase case format Example string and if case sensative 'c', creating new word at each capital letter

func (STRING) ToSnake

func (s STRING) ToSnake() string

ToSnake converts STRING exampleStr to snake case format example_string

func (STRING) ToUpper

func (s STRING) ToUpper() string

ToUpper returns s with all Unicode letters mapped to their upper case

func (STRING) Trim

func (s STRING) Trim(cutset string) string

Trim returns a string with all leading and trailing chars in cutset removed

func (STRING) TrimWhitespace

func (s STRING) TrimWhitespace() string

TrimWhitespace removes all spaces, tabs and breaks in Str not contained within quotes panics if no all quotes are paired

func (STRING) Two

func (s STRING) Two(sep string) (x string, y string)

Two slices string into two substrings separated by sep

func (STRING) UINT

func (s STRING) UINT() UINT

UINT returns gotype STRING as a gotype UINT

func (STRING) UUID

func (s STRING) UUID() UUID

UUID returns gotype STRING as gotype UUID

func (STRING) Uint

func (s STRING) Uint() uint

Uint returns gotype STRING as gotype Uint

func (STRING) UnmarshalJson added in v0.0.19

func (s STRING) UnmarshalJson() (object map[string]any, list []any)

UnmarshalJson converts a json serialized STRING to a map or slice, respectively

func (STRING) UnmarshalJsonList added in v0.0.19

func (s STRING) UnmarshalJsonList(itemSep string) []string

func (STRING) UnmarshalJsonMap added in v0.0.19

func (s STRING) UnmarshalJsonMap(kvSep string, itemSep string) map[string]string

func (STRING) VALUE

func (s STRING) VALUE() VALUE

VALUE returns gotype SLICE as gotype VALUE

func (STRING) Width

func (s STRING) Width(N int) string

Width returns Str trucated or expanded with whitespaces to meet the N number of chars provided

type STRUCT

type STRUCT VALUE

func StructOf

func StructOf(a any) STRUCT

StructOf returns a as gotype STRUCT panics if a is not convertable to struct

func (STRUCT) ARRAY

func (s STRUCT) ARRAY() ARRAY

ARRAY returns the values of a gotype STRUCT as gotype ARRAY

func (STRUCT) Bool

func (s STRUCT) Bool() bool

Bool returns gotype STRUCT as bool true if struct has at least one field

func (STRUCT) Bytes

func (s STRUCT) Bytes() []byte

Bytes returns gotype STRUCT as serialized json []byte

func (STRUCT) Encode

func (s STRUCT) Encode() ENCODING

Bytes returns gotype STRUCT as []byte

func (STRUCT) Field

func (s STRUCT) Field(n string) (r FIELD)

Index returns FIELD with name n of STRUCT

func (*STRUCT) FieldIndex

func (s *STRUCT) FieldIndex() (index map[string]FIELD)

FieldIndex returns an index of field names in the Struct to Fields

func (STRUCT) FieldNames

func (s STRUCT) FieldNames() []string

FieldNames returns a []string of names of fields in struct

func (STRUCT) ForEach

func (s STRUCT) ForEach(f func(i int, f string, v VALUE) (brake bool))

ForEach executes function f on each item in STRUCT, note: f is the field name

func (STRUCT) ForFields

func (s STRUCT) ForFields(inclDetail bool, f func(i int, f FIELD) (brake bool))

ForFields executes function f on each field in STRUCT; note: f is the struct field; tag and name are populated when inclDetail is true

func (STRUCT) Gmap added in v0.0.19

func (s STRUCT) Gmap() Gmap

Gmap returns gotype STRUCT as gotype Gmap

func (STRUCT) GmapByTag added in v0.0.19

func (s STRUCT) GmapByTag(tag string) Gmap

GmapByTag returns gotype STRUCT as gotype Gmap

func (STRUCT) Index

func (s STRUCT) Index(i int) VALUE

Index returns the value found at index i of STRUCT

func (STRUCT) Interface

func (s STRUCT) Interface() any

Interface returns gotype STRUCT as a golang interface{}

func (STRUCT) JSON

func (s STRUCT) JSON() JSON

JSON returns gotype STRUCT as gotype JSON

func (STRUCT) JsonByTag

func (s STRUCT) JsonByTag(tag string) JSON

JsonByTag returns gotype STRUCT as gotype JSON using provided tag as keys

func (STRUCT) Len

func (s STRUCT) Len() int

Len returns the number of fields in STRUCT

func (STRUCT) MAP

func (s STRUCT) MAP() MAP

MAP returns gotype STRUCT as MAP

func (STRUCT) Map

func (s STRUCT) Map() map[string]any

Map returns gotype STRUCT as map[string]any

func (STRUCT) MapByTag

func (s STRUCT) MapByTag(tag string) (m map[string]any)

func (STRUCT) MapByTagMap

func (s STRUCT) MapByTagMap(tag string) MAP

func (STRUCT) MapFormatted

func (s STRUCT) MapFormatted(format StrFormat) (m map[string]any)

func (STRUCT) Name

func (s STRUCT) Name() string

Name returns the name of the struct type as a string

func (STRUCT) Native

func (s STRUCT) Native() any

Natural returns underlyding value of gotype STRUCT as a golang interface{}

func (STRUCT) NumField

func (s STRUCT) NumField() int

NumField returns the number of fields in STRUCT

func (STRUCT) Pointer added in v0.0.4

func (s STRUCT) Pointer() unsafe.Pointer

Pointer returns the pointer to gotype STRUCT

func (STRUCT) ReflectType

func (s STRUCT) ReflectType() reflect.Type

ReflectType returns the reflect.Type of gotype STRUCT

func (STRUCT) ReflectValue

func (s STRUCT) ReflectValue() reflect.Value

ReflectValue returns the reflect.Value of gotype STRUCT

func (STRUCT) SLICE

func (s STRUCT) SLICE() SLICE

SLICE returns gotype STRUCT as SLICE

func (STRUCT) Scan

func (s STRUCT) Scan(dest any, tags ...string)

Scan reads the values of STRUCT into the provided Struct pointer dest by mapping the field names (or field tags) to those of the dest Struct

func (STRUCT) Set

func (s STRUCT) Set(i int, v any) STRUCT

Set updates the value at index i to value v, returns the StrUCT with the updated value

func (STRUCT) Slice

func (s STRUCT) Slice() []any

Slice returns gotype STRUCT field values as []any

func (STRUCT) String

func (s STRUCT) String() string

String returns gotype STRUCT as a serialized json string

func (STRUCT) Strings

func (s STRUCT) Strings() []string

Strings returns gotype STRUCT field values as []string

func (STRUCT) Struct

func (s STRUCT) Struct() any

Struct returns gotype STRUCT as interface()

func (*STRUCT) SubTagIndex

func (s *STRUCT) SubTagIndex(tag string, subTag string) map[string]FIELD

SubTagIndex returns an index of subtag values to Field in the Struct returns field names as keys if subtag value is not unique across fields

func (STRUCT) TYPE added in v0.0.4

func (s STRUCT) TYPE() *TYPE

TYPE returns the TYPE of gotype STRUCT

func (STRUCT) Tag

func (s STRUCT) Tag(t string, v string) (r FIELD)

Index returns FIELD with tag t having value v in STRUCT

func (*STRUCT) TagIndex

func (s *STRUCT) TagIndex(tag string) map[string]FIELD

TagIndex returns an index of tag values to Field in the Struct returns field names as keys if tag value is not unique across fields

func (STRUCT) VALUE

func (s STRUCT) VALUE() VALUE

VALUE returns gotype SLICE as gotype VALUE

type StrFormat

type StrFormat uint8

StrFormat represents the case format of a string Pascal: ExampleStr Camel: exampleStr Snake: example_string Phrase: Example string

const (
	None StrFormat = iota
	Pascal
	Camel
	Snake
	Phrase
	Upper
	Lower
)

func (StrFormat) Format

func (f StrFormat) Format(s string) string

Format converts string 's' to the StrFormat

type TIME

type TIME time.Time

func Christmas

func Christmas(y int) TIME

Christmas returns the observed date for Christmas Day for year 'y'

func ColumbusDay

func ColumbusDay(y int) TIME

ColumbusDay returns the date of Columbus Day for year 'y'

func Easter

func Easter(y int) TIME

Easter returns the date of easter for year 'y'

func GoodFriday

func GoodFriday(y int) TIME

GoodFriday returns the date of good friday for year 'y'

func HolidayObserved

func HolidayObserved(h TIME) TIME

HolidayObserved returns the date holiday 'h' is observed, Friday if on Saturday and Monday if on Sunday

func InagurationDay

func InagurationDay(y int) TIME

InagurationDay returns the date of the presidential inaguration for year 'y'

func IndependenceDay

func IndependenceDay(y int) TIME

IndependenceDay returns the observed date for US Independence Day for year 'y'

func Instance

func Instance(i int, wd Weekday, m Month, y int) TIME

Instance returns the date of the 'i' instance of weekday 'wd' in month 'm' of year 'y'; if i < 0 returns the last instance, and panics if 'i' is 0 or exceeds the number of instances

func LaborDay

func LaborDay(y int) TIME

LaborDay returns the date of Labor Day for year 'y'

func MemorialDay

func MemorialDay(y int) TIME

MemorialDay returns the date of Memorial Day for year 'y'

func MlkDay

func MlkDay(y int) TIME

MlkDay returns the date of Martin Luther King Jr Day for year 'y'

func NationalIndependenceDay

func NationalIndependenceDay(y int) TIME

NationalIndependenceDay returns the observed date for Junteenth National Independence Day for year 'y'

func NewDate

func NewDate(year int, month int, day int) TIME

func NewTime

func NewTime(year int, month int, day int, hour int, min int, sec int, nsec int, loc *time.Location) TIME

func NewYears

func NewYears(y int) TIME

NewYears returns the observed date for new years day of for year 'y'

func Now

func Now() TIME

func ParseTime

func ParseTime(f string, v string) TIME

func PresidentsDay

func PresidentsDay(y int) TIME

PresidentsDay returns the date of President's Day (or Washington's Birthday) for year 'y'

func Thanksgiving

func Thanksgiving(y int) TIME

Thanksgiving returns the date of Thanksgiving Day for year 'y'

func VeteransDay

func VeteransDay(y int) TIME

VeteransDay returns the observed date for Veterans Day for year 'y'

func (TIME) Add

func (t TIME) Add(d Duration) TIME

func (TIME) AddDate

func (t TIME) AddDate(years int, months int, days int) TIME

func (TIME) After

func (t TIME) After(u TIME) bool

func (TIME) Before

func (t TIME) Before(u TIME) bool

func (TIME) Bool

func (t TIME) Bool() bool

Bool returns gotype TIME as bool false if empty, true if a Time

func (TIME) Bytes

func (t TIME) Bytes() []byte

Bytes returns gotype TIME as []byte by first converting to int64 of nanoseconds and then to []byte

func (TIME) Date

func (t TIME) Date() TIME

func (TIME) Day

func (t TIME) Day() int

func (TIME) DaysInMonth

func (t TIME) DaysInMonth() int

DaysInMonth returns the number of calendar days in month of TIME 't'

func (TIME) DaysSince

func (t TIME) DaysSince(lt TIME) int

DaysSince returns the number of Days since lt until time t

func (TIME) Encode

func (t TIME) Encode() ENCODING

Encode returns a gotype encoding of TIME

func (TIME) Equal

func (t TIME) Equal(u TIME) bool

func (TIME) Float64

func (t TIME) Float64() float64

Float returns gotype TIME as float64 in Unix Time

func (TIME) Format

func (t TIME) Format(f string) string

func (TIME) Hour

func (t TIME) Hour() int

func (TIME) Int

func (t TIME) Int() int

Int returns gotype TIME as int in Unix Time

func (TIME) Interface

func (t TIME) Interface() any

Interface returns gotype TIME as a golang interface{}

func (TIME) IsDate

func (t TIME) IsDate() bool

func (TIME) IsHoliday

func (t TIME) IsHoliday() (Holiday, bool)

func (TIME) Location

func (t TIME) Location() *time.Location

func (TIME) Minute

func (t TIME) Minute() int

func (TIME) Month

func (t TIME) Month() int

func (TIME) MonthEnd

func (t TIME) MonthEnd() TIME

MonthEnd returns the last nanosecond of the month for time 't'

func (TIME) MonthStart

func (t TIME) MonthStart() TIME

MonthStart returns the first date of the month for time 't'

func (TIME) MonthsSince

func (t TIME) MonthsSince(lt TIME) int

MonthsSince returns the number of full Months since lt until time t

func (TIME) Nanosecond

func (t TIME) Nanosecond() int

func (TIME) Native

func (t TIME) Native() time.Time

Natural returns gotype TIME as golang time.Time

func (TIME) QuarterEnd

func (t TIME) QuarterEnd(ye int) TIME

QuarterEnd returns the last nanosecond of the quarter for time 't' with year ending in month 'ye'

func (TIME) QuarterStart

func (t TIME) QuarterStart(ye int) TIME

QuarterStart returns the first date of the quarter for time 't' with year ending in month 'ye'

func (TIME) Round

func (t TIME) Round(d Duration) TIME

func (TIME) STRING

func (t TIME) STRING() STRING

STRING returns gotype TIME as a gotype STRING

func (TIME) Second

func (t TIME) Second() int

func (TIME) String

func (t TIME) String() string

String returns gotype TIME as string

func (TIME) Sub

func (t TIME) Sub(u TIME) Duration

func (TIME) Time

func (t TIME) Time() time.Time

Time returns gotype TIME as time.Time

func (TIME) Uint

func (t TIME) Uint() uint

Uint returns gotype TIME as uint in Unix Time

func (TIME) Unix

func (t TIME) Unix() int

func (TIME) UnixNano

func (t TIME) UnixNano() int

func (TIME) VALUE

func (t TIME) VALUE() VALUE

VALUE returns gotype TIME as gotype VALUE

func (TIME) Weekday

func (t TIME) Weekday() Weekday

func (TIME) Year

func (t TIME) Year() int

func (TIME) YearEnd

func (t TIME) YearEnd(ye int) TIME

YearEnd returns the last nanosecond of the year for time 't' with year ending in month 'ye'

func (TIME) YearStart

func (t TIME) YearStart(ye int) TIME

YearStart returns the first date of the year for time 't' with year ending in month 'ye'

func (TIME) YearsSince

func (t TIME) YearsSince(lt TIME) int

YearsSince returns the number of full Years since lt until time t

type TYPE added in v0.0.4

type TYPE struct {
	// contains filtered or unexported fields
}

func FromReflectType added in v0.0.11

func FromReflectType(t reflect.Type) *TYPE

FromReflectType returns the gotype of reflect.Type t

func TypeOf added in v0.0.8

func TypeOf(a any) *TYPE

TypeOf returns the gotype of value a

func (*TYPE) DeepPtrElem added in v0.0.27

func (t *TYPE) DeepPtrElem() *TYPE

func (*TYPE) Elem added in v0.0.9

func (t *TYPE) Elem() *TYPE

Elem returns the TYPE of the element of the TYPE

func (*TYPE) Field added in v0.0.11

func (t *TYPE) Field(i int) *FieldType

Field returns the TYPE of the field at index i in a struct TYPE

func (*TYPE) FieldByIndex added in v0.0.11

func (t *TYPE) FieldByIndex(index []int) *FieldType

FieldByIndex returns the TYPE of the field at index in a struct TYPE

func (*TYPE) FieldByName added in v0.0.11

func (t *TYPE) FieldByName(name string) *FieldType

FieldByName returns the TYPE of the field with name in a struct TYPE

func (*TYPE) FieldByTag added in v0.0.11

func (t *TYPE) FieldByTag(tag string, value string) *FieldType

FieldByTag returns the TYPE of the field with tag value in a struct TYPE

func (*TYPE) FieldIndex added in v0.0.16

func (t *TYPE) FieldIndex(name string) int

FieldIndex returns the index of the field with name in a struct TYPE

func (*TYPE) FieldName added in v0.0.11

func (t *TYPE) FieldName(i int) string

FieldName returns the name of the field at index i in a struct TYPE

func (*TYPE) FieldTag added in v0.0.11

func (t *TYPE) FieldTag(name string) string

FieldTag returns the tag of the field with name in a struct TYPE

func (*TYPE) FieldTagValue added in v0.0.11

func (t *TYPE) FieldTagValue(name string, tag string) string

FieldTagValue returns the value of the tag of the field with name in a struct TYPE

func (*TYPE) ForFields added in v0.0.11

func (t *TYPE) ForFields(f func(i int, f *FieldType) (brake bool))

ForFields iterates over the fields of a struct TYPE and calls the function f with the index and TYPE of each field

func (*TYPE) HasDataElem added in v0.0.19

func (t *TYPE) HasDataElem() bool

func (*TYPE) HasDataField added in v0.0.19

func (t *TYPE) HasDataField() bool

HasDataField returns true if the struct TYPE has a field with a data type of array, chan, map, slice, struct, bytes or interface

func (*TYPE) IfaceIndir added in v0.0.4

func (t *TYPE) IfaceIndir() bool

IfaceIndir returns true if the TYPE is an indirect value

func (*TYPE) In added in v0.0.11

func (t *TYPE) In(i int) *TYPE

In returns the TYPE of the input parameter at index i in a func TYPE

func (*TYPE) InTypes added in v0.0.32

func (t *TYPE) InTypes(types ...*TYPE) bool

func (*TYPE) IndexTag added in v0.0.15

func (t *TYPE) IndexTag(i int) string

IndexTag returns the tag of the field at index i in a struct TYPE

func (*TYPE) IndexTagValue added in v0.0.15

func (t *TYPE) IndexTagValue(i int, tag string) string

IndexTagValue returns the value of the tag of the field at index i in a struct TYPE

func (*TYPE) IsData added in v0.0.19

func (t *TYPE) IsData() bool

IsData returns true if the TYPE stores data which includes Array, Chan, Map, Slice, Struct, Bytes, Interface or is a pointer to one these types

func (*TYPE) IsError added in v0.0.20

func (t *TYPE) IsError() bool

func (*TYPE) IsFunc added in v0.0.11

func (t *TYPE) IsFunc() bool

IsFunc returns true if the TYPE is a func

func (*TYPE) IsStruct added in v0.0.11

func (t *TYPE) IsStruct() bool

IsStruct returns true if the TYPE is a struct

func (*TYPE) KIND added in v0.0.4

func (t *TYPE) KIND() KIND

KIND returns the gotype KIND of the TYPE which includes Bytes, Field, Time, Uuid

func (*TYPE) Kind added in v0.0.4

func (t *TYPE) Kind() KIND

Kind returns the KIND of the TYPE synonomous with reflect.Kind

func (*TYPE) Name added in v0.0.4

func (t *TYPE) Name() string

Name returns the name of the TYPE

func (*TYPE) NameShort added in v0.0.13

func (t *TYPE) NameShort() string

NameShort returns the short name of the TYPE excluding the package path, module name and pointer indicator

func (*TYPE) New added in v0.0.4

func (t *TYPE) New() VALUE

New returns an empty pointer to a new value of the TYPE

func (*TYPE) NewValue added in v0.0.4

func (t *TYPE) NewValue() VALUE

New returns a pointer to a new (non nil) value of the TYPE

func (*TYPE) NumField added in v0.0.11

func (t *TYPE) NumField() int

NumField returns the number of fields in a struct TYPE

func (*TYPE) NumIn added in v0.0.11

func (t *TYPE) NumIn() int

NumIn returns the number of input parameters in a func TYPE

func (*TYPE) NumOut added in v0.0.11

func (t *TYPE) NumOut() int

NumOut returns the number of output parameters in a func TYPE

func (*TYPE) Out added in v0.0.11

func (t *TYPE) Out(i int) *TYPE

Out returns the TYPE of the output parameter at index i in a func TYPE

func (*TYPE) PkgPath added in v0.0.13

func (t *TYPE) PkgPath() string

PkgPath returns the package path of a struct TYPE

func (*TYPE) PtrType added in v0.0.11

func (t *TYPE) PtrType() *TYPE

PtrType returns a new TYPE of a pointer to the TYPE

func (*TYPE) Reflect added in v0.0.9

func (t *TYPE) Reflect() reflect.Type

Reflect returns the reflect.Type of the TYPE

func (*TYPE) STRING added in v0.0.4

func (t *TYPE) STRING() STRING

STRING returns the gotype STRING representation of the TYPE

func (*TYPE) SoftMatch added in v0.0.31

func (t *TYPE) SoftMatch(typ *TYPE, ancestry ...*TYPE) bool

SoftMatch evaluates whether typ matches the data type structure of TYPE t although maybe not identical

func (*TYPE) String added in v0.0.4

func (t *TYPE) String() string

String returns the string representation of the TYPE

func (*TYPE) TagValues added in v0.0.19

func (t *TYPE) TagValues(tag string) (vals []string, has bool)

TagValues returns a slice of string values for tag across fields in a struct TYPE

type UINT

type UINT uint

func (UINT) BOOL

func (u UINT) BOOL() BOOL

BOOL returns gotype INT as a gotype Bool false if 0, otherwise true

func (UINT) Bool

func (u UINT) Bool() bool

Bool returns gotype INT as bool false if 0, otherwise true

func (UINT) Bytes

func (u UINT) Bytes() []byte

Bytes returns gotype INT as []byte

func (UINT) Encode

func (u UINT) Encode() ENCODING

Encode returns a gotype encoding of INT

func (UINT) FLOAT

func (u UINT) FLOAT() FLOAT

Float returns gotype UINT as a gotype FLOAT

func (UINT) Float64

func (u UINT) Float64() float64

Float returns gotype UINT as float64

func (UINT) Int

func (u UINT) Int() int

Int returns gotype UINT as int

func (UINT) Int16

func (u UINT) Int16() int16

Int16 returns gotype UINT as int16

func (UINT) Int32

func (u UINT) Int32() int32

Int32 returns gotype UINT as int32

func (UINT) Int64

func (u UINT) Int64() int64

Int64 returns gotype UINT as int64

func (UINT) Int8

func (u UINT) Int8() int8

Int8 returns gotype UINT as int8

func (UINT) Interface

func (u UINT) Interface() any

Interface returns gotype INT as a golang interface{}

func (UINT) Native

func (u UINT) Native() int

Natural returns gotype INT as a golang int

func (UINT) STRING

func (u UINT) STRING() STRING

Str returns gotype INT as a gotype STRING

func (UINT) String

func (u UINT) String() string

String returns gotype INT as string

func (UINT) TIME

func (u UINT) TIME() TIME

Time returns gotype UINT as gotype TIME using numberic value as unix seconds since Jan 1, 1970

func (UINT) Uint

func (u UINT) Uint() uint

Uint returns gotype UINT as uint

func (UINT) Uint16

func (u UINT) Uint16() uint16

Uint16 returns gotype UINT as uint16

func (UINT) Uint32

func (u UINT) Uint32() uint32

Uint32 returns gotype UINT as uint32

func (UINT) Uint64

func (u UINT) Uint64() uint64

Uint64 returns gotype UINT as uint64

func (UINT) Uint8

func (u UINT) Uint8() uint8

Uint8 returns gotype UINT as uint8

func (UINT) VALUE

func (u UINT) VALUE() VALUE

Value returns gotype Int as gotype Value

type UUID

type UUID uuid.UUID

func NewULID

func NewULID() UUID

func NewUUID

func NewUUID() UUID

NewUUID returns a randomly generated instance of UUID

func (UUID) Bool

func (u UUID) Bool() bool

Bool returns gotype UUID as bool false if empty, true if a UUID

func (UUID) Bytes

func (u UUID) Bytes() []byte

Bytes returns gotype UUID as gotype Bytes

func (UUID) Encode

func (u UUID) Encode() ENCODING

Encode returns a gotype encoding of UUID

func (UUID) Interface

func (u UUID) Interface() any

Interface returns gotype UUID as a golang interface{}

func (UUID) IsNil

func (u UUID) IsNil() bool

IsNil evaluates whether UUID is empty

func (UUID) Native

func (u UUID) Native() uuid.UUID

Natural returns gotype UUID as golang uuid.UUID

func (UUID) STRING

func (u UUID) STRING() STRING

STRING returns gotype UUID as a gotype STRING

func (UUID) String

func (u UUID) String() string

String returns gotype UUID as string

func (UUID) Uuid

func (u UUID) Uuid() uuid.UUID

Uuid returns gotype UUID as uuid.UUID

func (UUID) VALUE

func (u UUID) VALUE() VALUE

Value returns gotype UUID as gotype Value

type VALUE

type VALUE struct {
	// contains filtered or unexported fields
}

func FromReflect

func FromReflect(v reflect.Value) VALUE

func ValueOf

func ValueOf(a any) VALUE

func ValueOfV

func ValueOfV(a any) VALUE

func (VALUE) ARRAY

func (v VALUE) ARRAY() ARRAY

ARRAY returns VALUE as gotype ARRAY

func (VALUE) Append

func (v VALUE) Append(a ...any) VALUE

Append adds the provided a to the end of a Slice, panics if VALUE is not a Slice

func (VALUE) BOOL

func (v VALUE) BOOL() BOOL

BOOL returns gotype VALUE as gotype BOOL

func (VALUE) Bool

func (v VALUE) Bool() bool

Bool returns gotype VALUE as bool

func (VALUE) Bytes

func (v VALUE) Bytes() []byte

Bytes returns gotype VALUE as []byte

func (VALUE) BytesFixedLen

func (v VALUE) BytesFixedLen() []byte

BytesFixed returns the bytes from the value of a kind with a fixed number of bytes (eg. int)

func (VALUE) Cast

func (v VALUE) Cast(k KIND) any

func (VALUE) Convert

func (v VALUE) Convert(a any) any

func (VALUE) Copy added in v0.0.19

func (v VALUE) Copy() VALUE

func (VALUE) Elem

func (v VALUE) Elem() VALUE

Elem returns the underlying value of a pointer

func (VALUE) ElemDeep

func (v VALUE) ElemDeep() VALUE

ElemDeep cascades a series of pointers to return the underlying VALUE

func (VALUE) ElemKind

func (v VALUE) ElemKind() KIND

ElemKind returns the KIND of the underlying Value(s)

func (VALUE) Encode

func (v VALUE) Encode() ENCODING

func (VALUE) EncodeNum

func (v VALUE) EncodeNum() ENCODING

EncodeNum returns the byte encoding from a value of a number (eg.int)

func (VALUE) Extend

func (v VALUE) Extend(n int) VALUE

Extend adds n elements to a Slice, panics if VALUE is not a Slice

func (VALUE) FLOAT

func (v VALUE) FLOAT() FLOAT

FLOAT returns gotype VALUE as gotype FLOAT

func (VALUE) Float64

func (v VALUE) Float64() float64

Float64 returns gotype VALUE as float64

func (VALUE) ForEach

func (v VALUE) ForEach(f func(i int, k string, v VALUE) (brake bool))

ForEach executes function f on each item in VALUE, where VALUE is an Array, Map, Slice, String, or Struct, k is "" for Array, Slice and String, i is not fixed for Maps

func (VALUE) Gmap added in v0.0.19

func (v VALUE) Gmap() Gmap

Map returns gotype VALUE as map[string]VALUE

func (VALUE) HasDataElem added in v0.0.19

func (v VALUE) HasDataElem() bool

func (VALUE) INT

func (v VALUE) INT() INT

INT returns gotype VALUE as gotype INT

func (VALUE) Index

func (v VALUE) Index(i int) VALUE

Index returns the value found at index i of VALUE returns VALUE if not an Array, Map, Pointer, Slice, String or Struct does not panic if i is greater than len of VALUE

func (VALUE) Init

func (v VALUE) Init() VALUE

func (VALUE) InspectDataElems added in v0.0.19

func (v VALUE) InspectDataElems() bool

func (VALUE) Int

func (v VALUE) Int() int

Int returns gotype VALUE as int

func (VALUE) Interface

func (v VALUE) Interface() any

Interface returns VALUE as interface {}

func (VALUE) IsData added in v0.0.19

func (v VALUE) IsData() bool

func (VALUE) IsNil added in v0.0.19

func (v VALUE) IsNil() bool

IsNil returns true if VALUE is nil

func (VALUE) IsPtr

func (v VALUE) IsPtr() bool

IsPtr evaluates whether Value is a pointer to a value

func (VALUE) IsZero added in v0.0.19

func (v VALUE) IsZero() bool

IsZero returns true if VALUE is the zero value or nil

func (VALUE) JSON

func (v VALUE) JSON() JSON

JSON returns VALUE as gotype JSON

func (VALUE) KIND

func (v VALUE) KIND() KIND

Kind returns the kind of data type of Value

func (VALUE) Kind

func (v VALUE) Kind() KIND

Kind returns the kind of data type of Value

func (VALUE) Len

func (v VALUE) Len() int

Len returns the number of items in VALUE panics if Value is not of a struct, array, map, slice, string

func (VALUE) MAP

func (v VALUE) MAP() MAP

MAP returns VALUE as gotype MAP

func (VALUE) MapIndex

func (v VALUE) MapIndex(i string) VALUE

MapIndex returns the value found at index (key) i in map, panics if VALUE is not a map

func (VALUE) Marshal added in v0.0.19

func (v VALUE) Marshal(m *Marshaler) *Marshaler

func (VALUE) New

func (v VALUE) New(init ...bool) VALUE

New returns a new empty value of VALUE type, if ptr is nil and init != true, returns nil ptr

func (VALUE) NewDeep

func (v VALUE) NewDeep() VALUE

NewDeep returns a new empty value of VALUE type with matching number of elements and no nil spaces

func (VALUE) Pointer

func (v VALUE) Pointer() unsafe.Pointer

UnsafePointer returns the an unsafe.Pointer to the underlying Value

func (VALUE) PointerTo

func (v VALUE) PointerTo() VALUE

PointerTo returns a pointer to the underlying value, if the value is a string, returns *string as VALUE

func (VALUE) PtrKind

func (v VALUE) PtrKind() KIND

PtrKind returns the Kind of the underlying Value

func (VALUE) Reflect

func (v VALUE) Reflect() reflect.Value

func (VALUE) SLICE

func (v VALUE) SLICE() SLICE

SLICE returns VALUE as gotype SLICE

func (VALUE) STRING

func (v VALUE) STRING() STRING

STRING returns gotype VALUE as gotype STRING

func (VALUE) STRUCT

func (v VALUE) STRUCT() STRUCT

STRUCT returns VALUE as gotype STRUCT

func (VALUE) Scan

func (v VALUE) Scan(dest any, tags ...string)

Scan reads the values of VALUE into the provided destination pointer, the VALUE must be a a struct, array, map, slice or pointer to one of these, the number of elements in dest must be greater than or equal to the number of elements in VALUE, otherwise Scan will panic

func (VALUE) Set

func (v VALUE) Set(a any) VALUE

Set updates the VALUE to a and returns VALUE

func (VALUE) SetIndex

func (v VALUE) SetIndex(key any, val any) VALUE

SetIndex sets the value of a key (or index) for a slice, array, map, struct or string

func (VALUE) SetType

func (v VALUE) SetType() VALUE

SetType sets the actual data type of interface VALUE

func (VALUE) String

func (v VALUE) String() string

String returns gotype VALUE as golang string

func (VALUE) StructField

func (v VALUE) StructField(f string) FIELD

StructField returns the field with name f in struct, panics if VALUE is not a struct

func (VALUE) TIME

func (v VALUE) TIME() TIME

TIME returns gotype VALUE as gotype TIME

func (VALUE) TYPE added in v0.0.8

func (v VALUE) TYPE() *TYPE

Type returns the *rtype of VALUE

func (VALUE) TypeMatch

func (v VALUE) TypeMatch(a any) bool

TypeMatch evaluates whether the type of a is the same type of Value

func (VALUE) UINT

func (v VALUE) UINT() UINT

UINT returns gotype VALUE as gotype UINT

func (VALUE) UUID

func (v VALUE) UUID() UUID

UUID returns gotype Value as UUID

func (VALUE) Uint

func (v VALUE) Uint() uint

Uint returns gotype VALUE as uint

func (VALUE) Uintptr

func (v VALUE) Uintptr() uintptr

Uintptr returns the uintptr representation of a pointer to the underlying Value

type Weekday

type Weekday int

Weekday specifies a day of the week (Sunday = 0, ...).

const (
	Sunday Weekday = iota
	Monday
	Tuesday
	Wednesday
	Thursday
	Friday
	Saturday
)

Jump to

Keyboard shortcuts

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