entity

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2020 License: MIT Imports: 7 Imported by: 2

README

entity

Go json access like viper

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToStringMapSlice

func ToStringMapSlice(i interface{}) ([]map[string]interface{}, error)

ToStringMapSlice casts an interface to a []map[string]interface{} type.

Types

type Entity

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

func New

func New(data map[string]interface{}) *Entity

New returns an initialized Entity instance.

func NewByJson

func NewByJson(data []byte) *Entity

NewByJson returns an initialized Entity instance by json byte[].

func (*Entity) Get

func (entity *Entity) Get(key string) interface{}

Get can retrieve any value given the key to use. Get returns an interface. For a specific value use one of the Get____ methods.

func (*Entity) GetBool

func (entity *Entity) GetBool(key string) bool

GetBool returns the value associated with the key as a boolean.

func (*Entity) GetDuration

func (entity *Entity) GetDuration(key string) time.Duration

GetDuration returns the value associated with the key as a duration.

func (*Entity) GetFloat64

func (entity *Entity) GetFloat64(key string) float64

GetFloat64 returns the value associated with the key as a float64.

func (*Entity) GetInt

func (entity *Entity) GetInt(key string) int

GetInt returns the value associated with the key as an integer.

func (*Entity) GetInt32

func (entity *Entity) GetInt32(key string) int32

GetInt32 returns the value associated with the key as an integer.

func (*Entity) GetInt64

func (entity *Entity) GetInt64(key string) int64

GetInt64 returns the value associated with the key as an integer.

func (*Entity) GetIntSlice

func (entity *Entity) GetIntSlice(key string) []int

GetIntSlice returns the value associated with the key as a slice of int values.

func (*Entity) GetSizeInBytes

func (entity *Entity) GetSizeInBytes(key string) uint

GetSizeInBytes returns the size of the value associated with the given key in bytes.

func (*Entity) GetSlice

func (entity *Entity) GetSlice(key string) []interface{}

GetSlice returns the value associated with the key as a slice.

func (*Entity) GetString

func (entity *Entity) GetString(key string) string

GetString returns the value associated with the key as a string.

func (*Entity) GetStringMap

func (entity *Entity) GetStringMap(key string) map[string]interface{}

GetStringMap returns the value associated with the key as a map of interfaces.

func (*Entity) GetStringMapSlice

func (entity *Entity) GetStringMapSlice(key string) []map[string]interface{}

GetStringMapSlice returns the value associated with the key as a []map[string]interface{} slice.

func (*Entity) GetStringMapString

func (entity *Entity) GetStringMapString(key string) map[string]string

GetStringMapString returns the value associated with the key as a map of strings.

func (*Entity) GetStringMapStringSlice

func (entity *Entity) GetStringMapStringSlice(key string) map[string][]string

GetStringMapStringSlice returns the value associated with the key as a map to a slice of strings.

func (*Entity) GetStringSlice

func (entity *Entity) GetStringSlice(key string) []string

GetStringSlice returns the value associated with the key as a slice of strings.

func (*Entity) GetTime

func (entity *Entity) GetTime(key string) time.Time

GetTime returns the value associated with the key as time.

func (*Entity) GetUint

func (entity *Entity) GetUint(key string) uint

GetUint returns the value associated with the key as an unsigned integer.

func (*Entity) GetUint32

func (entity *Entity) GetUint32(key string) uint32

GetUint32 returns the value associated with the key as an unsigned integer.

func (*Entity) GetUint64

func (entity *Entity) GetUint64(key string) uint64

GetUint64 returns the value associated with the key as an unsigned integer.

func (*Entity) Set

func (entity *Entity) Set(key string, value interface{}) *Entity

Set sets the value for the key in the Entity

Jump to

Keyboard shortcuts

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