datatype

package module
v0.0.0-...-a114629 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: BSD-3-Clause Imports: 3 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertString

func ConvertString(s string) interface{}

convert string to different datatype. currectly support only int64, float64, and boolean if cannot pass it will return input string

func ConvertStringTo

func ConvertStringTo(s string, t interface{}) interface{}

convert string to different datatype base on input type. currectly support only int, uint, float, bool, and array. for int, uint and float: this function will always return 64 bits.

func ForceArray

func ForceArray(i interface{}) []interface{}

ForceArray will force to convert interface{} to array of interface{}

func ForceBool

func ForceBool(inf interface{}) (bool, bool)

ForceBool will force to convert interface{} to boolean

func ForceFloat

func ForceFloat(i interface{}) (float64, bool)

ForceFloat will force to convert interface{} to float

func ForceInt

func ForceInt(inf interface{}) (int64, bool)

ForceInt will force to convert interface{} to integer

func ForceString

func ForceString(i interface{}) string

ForceString will force to convert interface{} to string

func ToArray

func ToArray(a interface{}) ([]interface{}, bool)

ToArray will try to convert interface{} to array of interface{}

func ToBool

func ToBool(i interface{}) (bool, bool)

ToBool will try to convert interface{} to boolean

func ToFloat

func ToFloat(i interface{}) (float64, bool)

ToFloat will try to convert interface{} to float

func ToInt

func ToInt(i interface{}) (int64, bool)

ToInt will try to convert interface{} to integer

func ToString

func ToString(i interface{}) (string, bool)

ToString will try to convert interface{} to string

Types

type Queue

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

func NewLimitQueue

func NewLimitQueue(size int) *Queue

NewLimitQueue will create new limit queue

func NewQueue

func NewQueue() *Queue

NewQueue will create new infinity queue

func ToLimitQueue

func ToLimitQueue(size int, v []interface{}) *Queue

ToLimitQueue will try to convert array to limit queue

func ToQueue

func ToQueue(v []interface{}) *Queue

ToQueue will try to convert array to queue

func (*Queue) Dequeue

func (q *Queue) Dequeue() bool

If queue size is exceed limit, remove oldest data return true if data got removed

func (*Queue) Empty

func (q *Queue) Empty() bool

Empty will check whether queue empty or not

func (*Queue) Enqueue

func (q *Queue) Enqueue(d interface{}) *Queue

Add data to end of queue and maintain queue size

func (*Queue) Get

func (q *Queue) Get() interface{}

Get first queue and remove from the queue

func (*Queue) Head

func (q *Queue) Head() interface{}

Head will get first queue but not change queue size

func (*Queue) Size

func (q *Queue) Size() int

Size will get the size of queue

func (*Queue) Tail

func (q *Queue) Tail() interface{}

Tail will get last queue but not change queue size

Jump to

Keyboard shortcuts

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