generic

package
v0.0.0-...-64a9ce5 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: MIT Imports: 19 Imported by: 13

Documentation

Index

Constants

View Source
const (
	AsgTypeHeader       = "X-Asg-type"
	ContentTypeJson     = "application/json; charset=utf-8"
	ContentTypeHeader   = "Content-type"
	AuthorizationHeader = "Authorization"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(f Factory, c *http.Client, addr string) Client

func (Client) Send

func (c Client) Send(gReq Generic) (gRsp Generic, err error)

type Factory

type Factory interface {
	New(*graph.TypeNode) Generic
	NewSlice(*graph.TypeNode) Slice
	FromStruct(interface{}) (Generic, error)
	MustFromStruct(interface{}) Generic
	FromStructs(interface{}) (Slice, error)
	MustFromStructs(interface{}) Slice
	FromStringInterfaceMap(*graph.TypeNode, map[string]interface{}) (Generic, error)
	MustFromStringInterfaceMap(*graph.TypeNode, map[string]interface{}) Generic
	Unflatten(tn *graph.TypeNode, delimiter string, m map[string]interface{}) (Generic, error)
	MustUnflatten(tn *graph.TypeNode, delimiter string, m map[string]interface{}) Generic
	UnflattenSlice(tn *graph.TypeNode, delimiter string, ms []map[string]interface{}) (Slice, error)
	MustUnflattenSlice(tn *graph.TypeNode, delimiter string, ms []map[string]interface{}) Slice
}

func NewFactory

func NewFactory(root *graph.RootNode) Factory

type Generic

type Generic interface {
	MustDelete(...string)
	Delete(...string) error
	WalkDelete(func(fn *graph.FieldNode) bool)
	String(...string) (string, bool)
	MustString(...string) string
	Int32(...string) (int32, bool)
	MustInt32(...string) int32
	Float64(...string) (float64, bool)
	MustFloat64(...string) float64
	Bool(...string) (bool, bool)
	MustBool(...string) bool
	Generic(...string) (Generic, bool)
	MustGeneric(...string) Generic
	Int32Slice(...string) ([]int32, bool)
	MustInt32Slice(...string) []int32
	Float64Slice(...string) ([]float64, bool)
	MustFloat64Slice(...string) []float64
	BoolSlice(...string) ([]bool, bool)
	MustBoolSlice(...string) []bool
	StringSlice(...string) ([]string, bool)
	MustStringSlice(...string) []string
	GenericSlice(...string) (Slice, bool)
	MustGenericSlice(...string) Slice
	FieldNames() []string
	EachInt32(func(fn *graph.FieldNode, i int32))
	EachFloat64(func(fn *graph.FieldNode, f float64))
	EachBool(func(fn *graph.FieldNode, b bool))
	EachString(func(fn *graph.FieldNode, s string))
	EachGeneric(func(fn *graph.FieldNode, g Generic))
	EachInt32Slice(func(fn *graph.FieldNode, is []int32))
	EachFloat64Slice(func(fn *graph.FieldNode, fs []float64))
	EachBoolSlice(func(fn *graph.FieldNode, bs []bool))
	EachStringSlice(func(fn *graph.FieldNode, ss []string))
	EachGenericSlice(func(fn *graph.FieldNode, gSlice Slice))
	SetString([]string, string) error
	MustSetString([]string, string) Generic
	SetInt32([]string, int32) error
	MustSetInt32([]string, int32) Generic
	SetFloat64([]string, float64) error
	MustSetFloat64([]string, float64) Generic
	SetBool([]string, bool) error
	MustSetBool([]string, bool) Generic
	SetEnum([]string, string) error
	MustSetEnum([]string, string) Generic
	SetGeneric([]string, Generic) error
	MustSetGeneric([]string, Generic) Generic
	SetInt32Slice([]string, []int32) error
	MustSetInt32Slice([]string, []int32) Generic
	SetFloat64Slice([]string, []float64) error
	MustSetFloat64Slice([]string, []float64) Generic
	SetBoolSlice([]string, []bool) error
	MustSetBoolSlice([]string, []bool) Generic
	SetStringSlice([]string, []string) error
	MustSetStringSlice([]string, []string) Generic
	SetGenericSlice([]string, Slice) error
	MustSetGenericSlice([]string, Slice) Generic
	Copy() Generic
	Select(gSelect Generic)
	Type() *graph.TypeNode
	Print()
	PrintDebug()
	Sprint() string
	Sanitize()
	Hash()
	GetHash() string
	ToStruct(interface{}) error
	MustToStruct(interface{})
	ToStringInterfaceMap() map[string]interface{}
	Flatten(delimiter string) (map[string]interface{}, error)
	MustFlatten(delimiter string) map[string]interface{}
}

func Send

func Send(f Factory, client *http.Client, addr string, username string, password string, gReq Generic) (gRsp Generic, err error)

type MultiMapFactory

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

func (MultiMapFactory) FromStringInterfaceMap

func (f MultiMapFactory) FromStringInterfaceMap(tn *graph.TypeNode, m map[string]interface{}) (g Generic, err error)

func (MultiMapFactory) FromStruct

func (f MultiMapFactory) FromStruct(i interface{}) (Generic, error)

func (MultiMapFactory) FromStructs

func (f MultiMapFactory) FromStructs(is interface{}) (gs Slice, err error)

func (MultiMapFactory) MustFromStringInterfaceMap

func (f MultiMapFactory) MustFromStringInterfaceMap(tn *graph.TypeNode, m map[string]interface{}) Generic

func (MultiMapFactory) MustFromStruct

func (f MultiMapFactory) MustFromStruct(any interface{}) Generic

func (MultiMapFactory) MustFromStructs

func (f MultiMapFactory) MustFromStructs(any interface{}) Slice

func (MultiMapFactory) MustUnflatten

func (f MultiMapFactory) MustUnflatten(tn *graph.TypeNode, delimiter string, m map[string]interface{}) Generic

func (MultiMapFactory) MustUnflattenSlice

func (f MultiMapFactory) MustUnflattenSlice(tn *graph.TypeNode, delimiter string, ms []map[string]interface{}) Slice

func (MultiMapFactory) New

func (MultiMapFactory) NewSlice

func (f MultiMapFactory) NewSlice(tn *graph.TypeNode) Slice

func (MultiMapFactory) Unflatten

func (f MultiMapFactory) Unflatten(tn *graph.TypeNode, delimiter string, m map[string]interface{}) (Generic, error)

func (MultiMapFactory) UnflattenSlice

func (f MultiMapFactory) UnflattenSlice(tn *graph.TypeNode, delimiter string, ms []map[string]interface{}) (Slice, error)

type MultiMapGeneric

type MultiMapGeneric struct {
	String0       map[string]string
	Int           map[string]int
	Int320        map[string]int32
	Uint320       map[string]uint32
	Float640      map[string]float64
	Bool0         map[string]bool
	StringSlice0  map[string][]string
	Int32Slice0   map[string][]int32
	Uint32Slice0  map[string][]uint32
	Float64Slice0 map[string][]float64
	BoolSlice0    map[string][]bool
	Generic0      map[string]*MultiMapGeneric
	GenericSlice0 map[string]*MultiMapSlice
	// contains filtered or unexported fields
}

func NewMultiMapGeneric

func NewMultiMapGeneric(t *graph.TypeNode) *MultiMapGeneric

func (*MultiMapGeneric) Bool

func (g *MultiMapGeneric) Bool(names ...string) (i bool, b bool)

func (*MultiMapGeneric) BoolSlice

func (g *MultiMapGeneric) BoolSlice(names ...string) (i []bool, b bool)

func (*MultiMapGeneric) Copy

func (g *MultiMapGeneric) Copy() Generic

func (*MultiMapGeneric) Delete

func (g *MultiMapGeneric) Delete(names ...string) (err error)

func (*MultiMapGeneric) EachBool

func (g *MultiMapGeneric) EachBool(f func(fn *graph.FieldNode, v bool))

func (*MultiMapGeneric) EachBoolSlice

func (g *MultiMapGeneric) EachBoolSlice(f func(fn *graph.FieldNode, v []bool))

func (*MultiMapGeneric) EachEnum

func (g *MultiMapGeneric) EachEnum(f func(fn *graph.FieldNode, v string))

func (*MultiMapGeneric) EachEnumSlice

func (g *MultiMapGeneric) EachEnumSlice(f func(fn *graph.FieldNode, v []string))

func (*MultiMapGeneric) EachFloat64

func (g *MultiMapGeneric) EachFloat64(f func(fn *graph.FieldNode, v float64))

func (*MultiMapGeneric) EachFloat64Slice

func (g *MultiMapGeneric) EachFloat64Slice(f func(fn *graph.FieldNode, v []float64))

func (*MultiMapGeneric) EachGeneric

func (g *MultiMapGeneric) EachGeneric(f func(fn *graph.FieldNode, v Generic))

func (*MultiMapGeneric) EachGenericSlice

func (g *MultiMapGeneric) EachGenericSlice(f func(fn *graph.FieldNode, v Slice))

func (*MultiMapGeneric) EachInt32

func (g *MultiMapGeneric) EachInt32(f func(fn *graph.FieldNode, v int32))

func (*MultiMapGeneric) EachInt32Slice

func (g *MultiMapGeneric) EachInt32Slice(f func(fn *graph.FieldNode, v []int32))

func (*MultiMapGeneric) EachString

func (g *MultiMapGeneric) EachString(f func(fn *graph.FieldNode, v string))

func (*MultiMapGeneric) EachStringSlice

func (g *MultiMapGeneric) EachStringSlice(f func(fn *graph.FieldNode, v []string))

func (*MultiMapGeneric) Enum

func (g *MultiMapGeneric) Enum(names ...string) (i string, b bool)

func (*MultiMapGeneric) FieldNames

func (g *MultiMapGeneric) FieldNames() (ss []string)

func (*MultiMapGeneric) Flatten

func (g *MultiMapGeneric) Flatten(delimiter string) (m map[string]interface{}, err error)

func (*MultiMapGeneric) Float64

func (g *MultiMapGeneric) Float64(names ...string) (i float64, b bool)

func (*MultiMapGeneric) Float64Slice

func (g *MultiMapGeneric) Float64Slice(names ...string) (i []float64, b bool)

func (*MultiMapGeneric) Generic

func (g *MultiMapGeneric) Generic(names ...string) (Generic, bool)

func (*MultiMapGeneric) GenericSlice

func (g *MultiMapGeneric) GenericSlice(names ...string) (gSlice Slice, ok bool)

func (*MultiMapGeneric) GetHash

func (g *MultiMapGeneric) GetHash() string

func (*MultiMapGeneric) Hash

func (g *MultiMapGeneric) Hash()

func (*MultiMapGeneric) Int32

func (g *MultiMapGeneric) Int32(names ...string) (i int32, b bool)

func (*MultiMapGeneric) Int32Slice

func (g *MultiMapGeneric) Int32Slice(names ...string) (i []int32, b bool)

func (*MultiMapGeneric) MustBool

func (g *MultiMapGeneric) MustBool(names ...string) bool

func (*MultiMapGeneric) MustBoolSlice

func (g *MultiMapGeneric) MustBoolSlice(names ...string) []bool

func (*MultiMapGeneric) MustDelete

func (g *MultiMapGeneric) MustDelete(names ...string)

func (*MultiMapGeneric) MustFlatten

func (g *MultiMapGeneric) MustFlatten(delimiter string) (m map[string]interface{})

func (*MultiMapGeneric) MustFloat64

func (g *MultiMapGeneric) MustFloat64(names ...string) float64

func (*MultiMapGeneric) MustFloat64Slice

func (g *MultiMapGeneric) MustFloat64Slice(names ...string) []float64

func (*MultiMapGeneric) MustGeneric

func (g *MultiMapGeneric) MustGeneric(names ...string) Generic

func (*MultiMapGeneric) MustGenericSlice

func (g *MultiMapGeneric) MustGenericSlice(names ...string) Slice

func (*MultiMapGeneric) MustInt32

func (g *MultiMapGeneric) MustInt32(names ...string) int32

func (*MultiMapGeneric) MustInt32Slice

func (g *MultiMapGeneric) MustInt32Slice(names ...string) []int32

func (*MultiMapGeneric) MustSetBool

func (g *MultiMapGeneric) MustSetBool(names []string, b bool) Generic

func (*MultiMapGeneric) MustSetBoolSlice

func (g *MultiMapGeneric) MustSetBoolSlice(names []string, bs []bool) Generic

func (*MultiMapGeneric) MustSetEnum

func (g *MultiMapGeneric) MustSetEnum(names []string, s string) Generic

func (*MultiMapGeneric) MustSetFloat64

func (g *MultiMapGeneric) MustSetFloat64(names []string, f float64) Generic

func (*MultiMapGeneric) MustSetFloat64Slice

func (g *MultiMapGeneric) MustSetFloat64Slice(names []string, fs []float64) Generic

func (*MultiMapGeneric) MustSetGeneric

func (g *MultiMapGeneric) MustSetGeneric(names []string, g0 Generic) Generic

func (*MultiMapGeneric) MustSetGenericSlice

func (g *MultiMapGeneric) MustSetGenericSlice(names []string, gSlice Slice) Generic

func (*MultiMapGeneric) MustSetInt32

func (g *MultiMapGeneric) MustSetInt32(names []string, i int32) Generic

func (*MultiMapGeneric) MustSetInt32Slice

func (g *MultiMapGeneric) MustSetInt32Slice(names []string, is []int32) Generic

func (*MultiMapGeneric) MustSetString

func (g *MultiMapGeneric) MustSetString(names []string, s string) Generic

func (*MultiMapGeneric) MustSetStringSlice

func (g *MultiMapGeneric) MustSetStringSlice(names []string, ss []string) Generic

func (*MultiMapGeneric) MustString

func (g *MultiMapGeneric) MustString(names ...string) string

func (*MultiMapGeneric) MustStringSlice

func (g *MultiMapGeneric) MustStringSlice(names ...string) []string

func (*MultiMapGeneric) MustToStruct

func (g *MultiMapGeneric) MustToStruct(output interface{})

func (*MultiMapGeneric) Print

func (g *MultiMapGeneric) Print()

func (*MultiMapGeneric) PrintDebug

func (g *MultiMapGeneric) PrintDebug()

func (*MultiMapGeneric) Sanitize

func (g *MultiMapGeneric) Sanitize()

func (*MultiMapGeneric) Select

func (g *MultiMapGeneric) Select(gSelect Generic)

func (*MultiMapGeneric) SetBool

func (g *MultiMapGeneric) SetBool(names []string, b bool) (err error)

func (*MultiMapGeneric) SetBoolSlice

func (g *MultiMapGeneric) SetBoolSlice(names []string, bs []bool) (err error)

func (*MultiMapGeneric) SetEnum

func (g *MultiMapGeneric) SetEnum(names []string, s string) (err error)

func (*MultiMapGeneric) SetFloat64

func (g *MultiMapGeneric) SetFloat64(names []string, f float64) (err error)

func (*MultiMapGeneric) SetFloat64Slice

func (g *MultiMapGeneric) SetFloat64Slice(names []string, fs []float64) (err error)

func (*MultiMapGeneric) SetGeneric

func (g *MultiMapGeneric) SetGeneric(names []string, g0 Generic) (err error)

func (*MultiMapGeneric) SetGenericSlice

func (g *MultiMapGeneric) SetGenericSlice(names []string, g0 Slice) (err error)

func (*MultiMapGeneric) SetInt32

func (g *MultiMapGeneric) SetInt32(names []string, i int32) (err error)

func (*MultiMapGeneric) SetInt32Slice

func (g *MultiMapGeneric) SetInt32Slice(names []string, is []int32) (err error)

func (*MultiMapGeneric) SetString

func (g *MultiMapGeneric) SetString(names []string, s string) (err error)

func (*MultiMapGeneric) SetStringSlice

func (g *MultiMapGeneric) SetStringSlice(names []string, ss []string) (err error)

func (*MultiMapGeneric) Sprint

func (g *MultiMapGeneric) Sprint() string

func (*MultiMapGeneric) String

func (g *MultiMapGeneric) String(names ...string) (i string, b bool)

func (*MultiMapGeneric) StringSlice

func (g *MultiMapGeneric) StringSlice(names ...string) (i []string, b bool)

func (*MultiMapGeneric) ToStringInterfaceMap

func (g *MultiMapGeneric) ToStringInterfaceMap() (m map[string]interface{})

func (*MultiMapGeneric) ToStruct

func (g *MultiMapGeneric) ToStruct(output interface{}) (err error)

func (*MultiMapGeneric) Type

func (g *MultiMapGeneric) Type() *graph.TypeNode

func (*MultiMapGeneric) WalkDelete

func (g *MultiMapGeneric) WalkDelete(f func(fn *graph.FieldNode) bool)

type MultiMapSlice

type MultiMapSlice struct {
	Gs []*MultiMapGeneric
	// contains filtered or unexported fields
}

func (*MultiMapSlice) Append

func (gSlice *MultiMapSlice) Append(gs0 ...Generic)

func (*MultiMapSlice) Copy

func (gSlice *MultiMapSlice) Copy() Slice

func (*MultiMapSlice) Filter

func (gSlice *MultiMapSlice) Filter(soft bool, gFilter Generic) (gSlice0 Slice)

func (*MultiMapSlice) Flatten

func (gSlice *MultiMapSlice) Flatten(delimiter string) (m map[string][]string, err error)

func (*MultiMapSlice) Get

func (gSlice *MultiMapSlice) Get() (gs0 []Generic)

func (*MultiMapSlice) Hash

func (gSlice *MultiMapSlice) Hash()

func (*MultiMapSlice) MustToStructs

func (gSlice *MultiMapSlice) MustToStructs(output interface{})

func (*MultiMapSlice) Print

func (gSlice *MultiMapSlice) Print()

func (*MultiMapSlice) Select

func (gSlice *MultiMapSlice) Select(gSelect Generic)

func (*MultiMapSlice) Set

func (gSlice *MultiMapSlice) Set(gs0 []Generic)

func (*MultiMapSlice) Sprint

func (gSlice *MultiMapSlice) Sprint() (s string)

func (*MultiMapSlice) ToStringInterfaceMaps

func (gSlice *MultiMapSlice) ToStringInterfaceMaps() (ms []map[string]interface{})

func (*MultiMapSlice) ToStructs

func (gSlice *MultiMapSlice) ToStructs(output interface{}) (err error)

func (*MultiMapSlice) Type

func (gSlice *MultiMapSlice) Type() *graph.TypeNode

type Server

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

func NewServer

func NewServer(c ServerOpts) Server

func (Server) ServeHTTP

func (s Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

type ServerOpts

type ServerOpts struct {
	Name    string
	Log     func(name string, b []byte, req *http.Request)
	Root    *graph.RootNode
	Factory Factory
	Handler func(ctx context.Context, gRequest Generic) (gResponse Generic)
	LogErr  func(err error)
}

type Slice

type Slice interface {
	Type() *graph.TypeNode
	Print()
	Sprint() string
	Copy() Slice
	Get() []Generic
	Set([]Generic)
	Append(...Generic)
	Filter(soft bool, gFilter Generic) Slice
	Select(gSelect Generic)
	Hash()
	Flatten(delimiter string) (map[string][]string, error)
	ToStringInterfaceMaps() []map[string]interface{}
	ToStructs(interface{}) error
	MustToStructs(interface{})
}

Jump to

Keyboard shortcuts

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