bsonutil

package
v0.0.0-...-6b8647c Latest Latest
Warning

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

Go to latest
Published: May 31, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DATETIME_TYPENAME  = "bson{datetime}"
	TIMESTAMP_TYPENAME = "bson{timestamp}"
	NULL_TYPENAME      = "bson{null}"
)

bson types

View Source
const (
	OBJECTID_TYPENAME = "bson{objectid}"
)

bson types

Variables

View Source
var ErrInvalidBSON = errors.New("invalid BSON")

Functions

func CastBSON

func CastBSON(L *lua.LState, idx int) interface{}

CastBSON casts glua value to bson, nil if not a valid bson value

func GetValue

func GetValue(l *lua.LState, idx int) interface{}

GetValue gets glua vm value to go value

func LDateTime

func LDateTime(L *lua.LState, dt primitive.DateTime) *lua.LUserData

LDateTime creates DateTime value for glua

func LNull

func LNull(L *lua.LState) *lua.LUserData

LNull creates Null value for glua

func LObjectID

func LObjectID(L *lua.LState, oid primitive.ObjectID) *lua.LUserData

LObjectID creates ObjectID value for glua

func LTimestamp

func LTimestamp(L *lua.LState, ts primitive.Timestamp) *lua.LUserData

LTimestamp creates Timestamp value for glua

func NewDateTime

func NewDateTime(L *lua.LState) int

NewDateTime new DateTime for glua

func NewObjectID

func NewObjectID(L *lua.LState) int

NewObjectID new ObjectID for glua

func NewTimestamp

func NewTimestamp(L *lua.LState) int

NewTimestamp new Timestamp for glua

func RegisterType

func RegisterType(L *lua.LState)

RegisterType registers bson types

func ToBSON

func ToBSON(L *lua.LState, idx int) interface{}

ToBSON converts glua value to bson, allow nil

func ToLuaValue

func ToLuaValue(l *lua.LState, i interface{}) lua.LValue

ToLuaValue converts go value to glua vm value

func UnmarshalBSON

func UnmarshalBSON(str string) (interface{}, error)

UnmarshalBSON unmarshals extended json to bson

func Value

func Value(l *lua.LState, v lua.LValue) interface{}

Value converts glua vm value to go value

Types

type DateTime

type DateTime struct {
	DT primitive.DateTime
}

DateTime mongo

type Null

type Null struct {
}

Null mongo

type ObjectID

type ObjectID struct {
	OID primitive.ObjectID
}

ObjectID mongo

type Timestamp

type Timestamp struct {
	Ts primitive.Timestamp
}

Timestamp mongo

Jump to

Keyboard shortcuts

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