bigdecimal

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

README

Use

//	"go.mongodb.org/mongo-driver/mongo/options"
// "github.com/lixvyang/go-utils/bigdecimal"
opt := options.Client().
		SetRegistry(
			bson.NewRegistryBuilder().RegisterCodec(
				reflect.TypeOf(decimal.Decimal{}), &bigdecimal.MongoDecimal{},
			).Build()).
		SetDirect(true)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoDecimal

type MongoDecimal struct{}

MongoDecimal is a ValueEncoder and ValueDecoder for encoding decimal.Decimal to Decimal128 and vice versa.

func (*MongoDecimal) DecodeValue

func (dc *MongoDecimal) DecodeValue(ect bsoncodec.DecodeContext, r bsonrw.ValueReader, value reflect.Value) error

func (*MongoDecimal) EncodeValue

func (dc *MongoDecimal) EncodeValue(ect bsoncodec.EncodeContext, w bsonrw.ValueWriter, value reflect.Value) error

Jump to

Keyboard shortcuts

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