base

package
v0.0.0-...-bac8e5f Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MicroTimestamp

func MicroTimestamp(t time.Time) int64

func Timestamp

func Timestamp(t time.Time) int64

Types

type Element

type Element struct {
	Key, Value interface{}
	// contains filtered or unexported fields
}

func (*Element) Next

func (e *Element) Next() *Element

Next returns the next element, or nil if it finished.

func (*Element) Prev

func (e *Element) Prev() *Element

Prev returns the previous element, or nil if it finished.

type OrderedMap

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

func NewOrderedMap

func NewOrderedMap() *OrderedMap

func (*OrderedMap) Back

func (m *OrderedMap) Back() *Element

Back will return the element that is the last (most recent Set element). If there are no elements this will return nil.

func (*OrderedMap) Delete

func (m *OrderedMap) Delete(key interface{}) (didDelete bool)

Delete will remove a key from the map. It will return true if the key was removed (the key did exist).

func (*OrderedMap) Front

func (m *OrderedMap) Front() *Element

Front will return the element that is the first (oldest Set element). If there are no elements this will return nil.

func (*OrderedMap) Get

func (m *OrderedMap) Get(key interface{}) (interface{}, bool)

Get returns the value for a key. If the key does not exist, the second return parameter will be false and the value will be nil.

func (*OrderedMap) GetElement

func (m *OrderedMap) GetElement(key interface{}) *Element

GetElement returns the element for a key. If the key does not exist, the pointer will be nil.

func (*OrderedMap) GetOrDefault

func (m *OrderedMap) GetOrDefault(key, defaultValue interface{}) interface{}

GetOrDefault returns the value for a key. If the key does not exist, returns the default value instead.

func (*OrderedMap) Keys

func (m *OrderedMap) Keys() (keys []interface{})

Keys returns all of the keys in the order they were inserted. If a key was replaced it will retain the same position. To ensure most recently set keys are always at the end you must always Delete before Set.

func (*OrderedMap) Len

func (m *OrderedMap) Len() int

Len returns the number of elements in the map.

func (*OrderedMap) Set

func (m *OrderedMap) Set(key, value interface{}) bool

Set will set (or replace) a value for a key. If the key was new, then true will be returned. The returned value will be false if the value was replaced (even if the value was the same).

type Struct

type Struct struct {
	Raw map[string]interface{}
	sync.RWMutex
}

func NewStruct

func NewStruct(data map[string]interface{}) *Struct

func (*Struct) DataAssignTo

func (r *Struct) DataAssignTo(val interface{})

func (*Struct) Get

func (r *Struct) Get(key string) (interface{}, bool)

func (*Struct) GetBool

func (r *Struct) GetBool(key string) (interface{}, bool)

func (*Struct) GetFloat

func (r *Struct) GetFloat(key string) (float64, bool)

func (*Struct) GetInt

func (r *Struct) GetInt(key string) (int, bool)

func (*Struct) GetSlice

func (r *Struct) GetSlice(key string) ([]interface{}, bool)

func (*Struct) GetString

func (r *Struct) GetString(key string) (string, bool)

func (*Struct) GetStruct

func (r *Struct) GetStruct(key string) (*Struct, bool)

func (*Struct) JsonMarshal

func (r *Struct) JsonMarshal() []byte

func (*Struct) Keys

func (r *Struct) Keys() []string

func (*Struct) Set

func (r *Struct) Set(key string, val interface{})

Jump to

Keyboard shortcuts

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