types

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Index

Constants

View Source
const KeyAny = "any"
View Source
const KeyBit = "bit"
View Source
const KeyBool = "bool"
View Source
const KeyByte = "byte"
View Source
const KeyChar = "char"
View Source
const KeyDate = "date"
View Source
const KeyEnum = "enum"
View Source
const KeyEnumValue = "enumValue"
View Source
const KeyError = "error"
View Source
const KeyFloat = "float"
View Source
const KeyInt = "int"
View Source
const KeyJSON = "json"
View Source
const KeyList = "list"
View Source
const KeyMap = "map"
View Source
const KeyMethod = "method"
View Source
const KeyNil = "nil"
View Source
const KeyOption = "option"
View Source
const KeyRange = "range"
View Source
const KeyReference = "reference"
View Source
const KeySet = "set"
View Source
const KeyString = "string"
View Source
const KeyTime = "time"
View Source
const KeyTimestamp = "timestamp"
View Source
const KeyTimestampZoned = "timestampZoned"
View Source
const KeyUUID = "uuid"
View Source
const KeyUnknown = "unknown"
View Source
const KeyValueMap = "valuemap"
View Source
const KeyXML = "xml"

Variables

This section is empty.

Functions

func TypeAs added in v0.2.5

func TypeAs[T any](t Type) T

Types

type Any

type Any struct{}

func (*Any) Default

func (x *Any) Default(string) any

func (*Any) From

func (x *Any) From(v any) any

func (*Any) Key

func (x *Any) Key() string

func (*Any) Scalar

func (x *Any) Scalar() bool

func (*Any) Sortable

func (x *Any) Sortable() bool

func (*Any) String

func (x *Any) String() string

type Argument

type Argument struct {
	Key  string   `json:"key"`
	Type *Wrapped `json:"type"`
}

func (Argument) String

func (a Argument) String() string

type Arguments

type Arguments []Argument

type Bit

type Bit struct{}

func (*Bit) Default

func (x *Bit) Default(string) any

func (*Bit) From

func (x *Bit) From(v any) any

func (*Bit) Key

func (x *Bit) Key() string

func (*Bit) Scalar

func (x *Bit) Scalar() bool

func (*Bit) Sortable

func (x *Bit) Sortable() bool

func (*Bit) String

func (x *Bit) String() string

type Bool

type Bool struct{}

func (*Bool) Default

func (x *Bool) Default(string) any

func (*Bool) From

func (x *Bool) From(v any) any

func (*Bool) Key

func (x *Bool) Key() string

func (*Bool) Scalar

func (x *Bool) Scalar() bool

func (*Bool) Sortable

func (x *Bool) Sortable() bool

func (*Bool) String

func (x *Bool) String() string

type Byte

type Byte struct{}

func (*Byte) Default

func (x *Byte) Default(string) any

func (*Byte) From

func (x *Byte) From(v any) any

func (*Byte) Key

func (x *Byte) Key() string

func (*Byte) Scalar

func (x *Byte) Scalar() bool

func (*Byte) Sortable

func (x *Byte) Sortable() bool

func (*Byte) String

func (x *Byte) String() string

type Char

type Char struct{}

func (*Char) Default

func (x *Char) Default(string) any

func (*Char) From

func (x *Char) From(v any) any

func (*Char) Key

func (x *Char) Key() string

func (*Char) Scalar

func (x *Char) Scalar() bool

func (*Char) Sortable

func (x *Char) Sortable() bool

func (*Char) String

func (x *Char) String() string

type Date

type Date struct{}

func (*Date) Default

func (x *Date) Default(string) any

func (*Date) From

func (x *Date) From(v any) any

func (*Date) Key

func (x *Date) Key() string

func (*Date) Scalar

func (x *Date) Scalar() bool

func (*Date) Sortable

func (x *Date) Sortable() bool

func (*Date) String

func (x *Date) String() string

type Enum

type Enum struct {
	Ref string `json:"ref"`
}

func (*Enum) Default

func (x *Enum) Default(key string) any

func (*Enum) From

func (x *Enum) From(v any) any

func (*Enum) Key

func (x *Enum) Key() string

func (*Enum) Scalar

func (x *Enum) Scalar() bool

func (*Enum) Sortable

func (x *Enum) Sortable() bool

func (*Enum) String

func (x *Enum) String() string

type EnumValue

type EnumValue struct{}

func (*EnumValue) Default

func (x *EnumValue) Default(key string) any

func (*EnumValue) From

func (x *EnumValue) From(v any) any

func (*EnumValue) Key

func (x *EnumValue) Key() string

func (*EnumValue) Scalar

func (x *EnumValue) Scalar() bool

func (*EnumValue) Sortable

func (x *EnumValue) Sortable() bool

func (*EnumValue) String

func (x *EnumValue) String() string

type Error

type Error struct {
	Message string `json:"message"`
}

func (*Error) Default

func (x *Error) Default(string) any

func (*Error) From

func (x *Error) From(v any) any

func (*Error) Key

func (x *Error) Key() string

func (*Error) Scalar

func (x *Error) Scalar() bool

func (*Error) Sortable

func (x *Error) Sortable() bool

func (*Error) String

func (x *Error) String() string

type Float

type Float struct {
	Bits int
}

func (*Float) Default

func (x *Float) Default(string) any

func (*Float) From

func (x *Float) From(v any) any

func (*Float) Key

func (x *Float) Key() string

func (*Float) Scalar

func (x *Float) Scalar() bool

func (*Float) Sortable

func (x *Float) Sortable() bool

func (*Float) String

func (x *Float) String() string

type Int

type Int struct {
	Bits     int  `json:"bits,omitempty"`
	Unsigned bool `json:"unsigned,omitempty"`
}

func (*Int) Default

func (x *Int) Default(string) any

func (*Int) From

func (x *Int) From(v any) any

func (*Int) Key

func (x *Int) Key() string

func (*Int) Scalar

func (x *Int) Scalar() bool

func (*Int) Sortable

func (x *Int) Sortable() bool

func (*Int) String

func (x *Int) String() string

type JSON

type JSON struct {
	IsObject bool `json:"obj,omitempty"`
	IsArray  bool `json:"arr,omitempty"`
}

func (*JSON) Default

func (x *JSON) Default(string) any

func (*JSON) From

func (x *JSON) From(v any) any

func (*JSON) Key

func (x *JSON) Key() string

func (*JSON) Scalar

func (x *JSON) Scalar() bool

func (*JSON) Sortable

func (x *JSON) Sortable() bool

func (*JSON) String

func (x *JSON) String() string

type List

type List struct {
	V    *Wrapped `json:"v"`
	Size int      `json:"size,omitempty"`
}

func (*List) Default

func (x *List) Default(string) any

func (*List) From

func (x *List) From(v any) any

func (*List) Key

func (x *List) Key() string

func (*List) Scalar

func (x *List) Scalar() bool

func (*List) Sortable

func (x *List) Sortable() bool

func (*List) String

func (x *List) String() string

type Map

type Map struct {
	K *Wrapped `json:"k"`
	V *Wrapped `json:"v"`
}

func (*Map) Default

func (x *Map) Default(string) any

func (*Map) From

func (x *Map) From(v any) any

func (*Map) Key

func (x *Map) Key() string

func (*Map) Scalar

func (x *Map) Scalar() bool

func (*Map) Sortable

func (x *Map) Sortable() bool

func (*Map) String

func (x *Map) String() string

type Method

type Method struct {
	Args Arguments `json:"args,omitempty"`
	Ret  *Wrapped  `json:"ret,omitempty"`
}

func (*Method) Default

func (x *Method) Default(key string) any

func (*Method) From

func (x *Method) From(v any) any

func (*Method) Key

func (x *Method) Key() string

func (*Method) Scalar

func (x *Method) Scalar() bool

func (*Method) Sortable

func (x *Method) Sortable() bool

func (*Method) String

func (x *Method) String() string

type Nil

type Nil struct{}

func (*Nil) Default

func (x *Nil) Default(string) any

func (*Nil) From

func (x *Nil) From(v any) any

func (*Nil) Key

func (x *Nil) Key() string

func (*Nil) Scalar

func (x *Nil) Scalar() bool

func (*Nil) Sortable

func (x *Nil) Sortable() bool

func (*Nil) String

func (x *Nil) String() string

type Option

type Option struct {
	V *Wrapped `json:"v"`
}

func (*Option) Default

func (x *Option) Default(string) any

func (*Option) From

func (x *Option) From(v any) any

func (*Option) Key

func (x *Option) Key() string

func (*Option) Scalar

func (x *Option) Scalar() bool

func (*Option) Sortable

func (x *Option) Sortable() bool

func (*Option) String

func (x *Option) String() string

type Range

type Range struct {
	V *Wrapped `json:"v"`
}

func (*Range) Default

func (x *Range) Default(string) any

func (*Range) From

func (x *Range) From(v any) any

func (*Range) Key

func (x *Range) Key() string

func (*Range) Scalar

func (x *Range) Scalar() bool

func (*Range) Sortable

func (x *Range) Sortable() bool

func (*Range) String

func (x *Range) String() string

type Reference

type Reference struct {
	Pkg util.Pkg `json:"pkg,omitempty"`
	K   string   `json:"k"`
}

func (*Reference) Default

func (x *Reference) Default(string) any

func (*Reference) From

func (x *Reference) From(v any) any

func (*Reference) Key

func (x *Reference) Key() string

func (*Reference) Path

func (x *Reference) Path() util.Pkg

func (*Reference) Scalar

func (x *Reference) Scalar() bool

func (*Reference) Sortable

func (x *Reference) Sortable() bool

func (*Reference) String

func (x *Reference) String() string

type Set

type Set struct {
	V *Wrapped `json:"v"`
}

func (*Set) Default

func (x *Set) Default(string) any

func (*Set) From

func (x *Set) From(v any) any

func (*Set) Key

func (x *Set) Key() string

func (*Set) Scalar

func (x *Set) Scalar() bool

func (*Set) Sortable

func (x *Set) Sortable() bool

func (*Set) String

func (x *Set) String() string

type String

type String struct {
	MinLength int    `json:"minLength,omitempty"`
	MaxLength int    `json:"maxLength,omitempty"`
	Pattern   string `json:"pattern,omitempty"`
}

func (*String) Default

func (x *String) Default(string) any

func (*String) From

func (x *String) From(v any) any

func (*String) Key

func (x *String) Key() string

func (*String) Scalar

func (x *String) Scalar() bool

func (*String) Sortable

func (x *String) Sortable() bool

func (*String) String

func (x *String) String() string

type Time

type Time struct{}

func (*Time) Default

func (x *Time) Default(string) any

func (*Time) From

func (x *Time) From(v any) any

func (*Time) Key

func (x *Time) Key() string

func (*Time) Scalar

func (x *Time) Scalar() bool

func (*Time) Sortable

func (x *Time) Sortable() bool

func (*Time) String

func (x *Time) String() string

type Timestamp

type Timestamp struct{}

func (*Timestamp) Default

func (x *Timestamp) Default(string) any

func (*Timestamp) From

func (x *Timestamp) From(v any) any

func (*Timestamp) Key

func (x *Timestamp) Key() string

func (*Timestamp) Scalar

func (x *Timestamp) Scalar() bool

func (*Timestamp) Sortable

func (x *Timestamp) Sortable() bool

func (*Timestamp) String

func (x *Timestamp) String() string

type TimestampZoned

type TimestampZoned struct{}

func (*TimestampZoned) Default

func (x *TimestampZoned) Default(string) any

func (*TimestampZoned) From

func (x *TimestampZoned) From(v any) any

func (*TimestampZoned) Key

func (x *TimestampZoned) Key() string

func (*TimestampZoned) Scalar

func (x *TimestampZoned) Scalar() bool

func (*TimestampZoned) Sortable

func (x *TimestampZoned) Sortable() bool

func (*TimestampZoned) String

func (x *TimestampZoned) String() string

type Type

type Type interface {
	Key() string
	Sortable() bool
	Scalar() bool
	fmt.Stringer
	From(v any) any
	Default(key string) any
}

type Types

type Types []Type

type UUID

type UUID struct{}

func (*UUID) Default

func (x *UUID) Default(string) any

func (*UUID) From

func (x *UUID) From(v any) any

func (*UUID) Key

func (x *UUID) Key() string

func (*UUID) Scalar

func (x *UUID) Scalar() bool

func (*UUID) Sortable

func (x *UUID) Sortable() bool

func (*UUID) String

func (x *UUID) String() string

type Unknown

type Unknown struct {
	X string `json:"x"`
}

func (*Unknown) Default

func (x *Unknown) Default(string) any

func (*Unknown) From

func (x *Unknown) From(v any) any

func (*Unknown) Key

func (x *Unknown) Key() string

func (*Unknown) Scalar

func (x *Unknown) Scalar() bool

func (*Unknown) Sortable

func (x *Unknown) Sortable() bool

func (*Unknown) String

func (x *Unknown) String() string

type ValueMap

type ValueMap struct{}

func (*ValueMap) Default

func (x *ValueMap) Default(s string) any

func (*ValueMap) From

func (x *ValueMap) From(v any) any

func (*ValueMap) Key

func (x *ValueMap) Key() string

func (*ValueMap) Scalar

func (x *ValueMap) Scalar() bool

func (*ValueMap) Sortable

func (x *ValueMap) Sortable() bool

func (*ValueMap) String

func (x *ValueMap) String() string

type Wrapped

type Wrapped struct {
	K string `json:"k"`
	T Type   `json:"t,omitempty"`
}

func FromReflect

func FromReflect(t reflect.Type) *Wrapped

func NewAny

func NewAny() *Wrapped

func NewBit

func NewBit() *Wrapped

func NewBool

func NewBool() *Wrapped

func NewByte

func NewByte() *Wrapped

func NewChar

func NewChar() *Wrapped

func NewDate

func NewDate() *Wrapped

func NewEnum

func NewEnum(ref string) *Wrapped

func NewEnumValue

func NewEnumValue() *Wrapped

func NewError

func NewError(msg string) *Wrapped

func NewFloat

func NewFloat(bits int) *Wrapped

func NewInt

func NewInt(bits int) *Wrapped

func NewJSON

func NewJSON() *Wrapped

func NewJSONArgs

func NewJSONArgs(obj bool, arr bool) *Wrapped

func NewList

func NewList(t *Wrapped) *Wrapped

func NewListSized

func NewListSized(t *Wrapped, size int) *Wrapped

func NewMap

func NewMap(k *Wrapped, v *Wrapped) *Wrapped

func NewMethod

func NewMethod(ret *Wrapped) *Wrapped

func NewOption

func NewOption(t *Wrapped) *Wrapped

func NewRange

func NewRange(t *Wrapped) *Wrapped

func NewReference

func NewReference() *Wrapped

func NewReferenceArgs

func NewReferenceArgs(pkg util.Pkg, k string) *Wrapped

func NewSet

func NewSet() *Wrapped

func NewString

func NewString() *Wrapped

func NewStringArgs

func NewStringArgs(minLength int, maxLength int, pattern string) *Wrapped

func NewTime

func NewTime() *Wrapped

func NewTimestamp

func NewTimestamp() *Wrapped

func NewTimestampZoned

func NewTimestampZoned() *Wrapped

func NewUUID

func NewUUID() *Wrapped

func NewUnknown

func NewUnknown(x string) *Wrapped

func NewUnsignedInt

func NewUnsignedInt(bits int) *Wrapped

func NewValueMap

func NewValueMap() *Wrapped

func NewXML

func NewXML() *Wrapped

func Wrap

func Wrap(t Type) *Wrapped

func (*Wrapped) Default

func (x *Wrapped) Default(key string) any

func (*Wrapped) EnumKey

func (x *Wrapped) EnumKey() string

func (*Wrapped) Equals added in v0.2.11

func (x *Wrapped) Equals(tgt *Wrapped) bool

func (*Wrapped) From

func (x *Wrapped) From(v any) any

func (*Wrapped) IsListOf added in v0.2.11

func (x *Wrapped) IsListOf(tgt *Wrapped) bool

func (*Wrapped) IsOption

func (x *Wrapped) IsOption() bool

func (*Wrapped) Key

func (x *Wrapped) Key() string

func (*Wrapped) MarshalJSON

func (x *Wrapped) MarshalJSON() ([]byte, error)

func (*Wrapped) Scalar

func (x *Wrapped) Scalar() bool

func (*Wrapped) Sortable

func (x *Wrapped) Sortable() bool

func (*Wrapped) String

func (x *Wrapped) String() string

func (*Wrapped) UnmarshalJSON

func (x *Wrapped) UnmarshalJSON(data []byte) error

type XML

type XML struct{}

func (*XML) Default

func (x *XML) Default(string) any

func (*XML) From

func (x *XML) From(v any) any

func (*XML) Key

func (x *XML) Key() string

func (*XML) Scalar

func (x *XML) Scalar() bool

func (*XML) Sortable

func (x *XML) Sortable() bool

func (*XML) String

func (x *XML) String() string

Jump to

Keyboard shortcuts

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