xbson

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBsonRegistryBuilder = NewBsonRegistryBuilder()

Functions

This section is empty.

Types

type BsonCodecsRegistrant

type BsonCodecsRegistrant func(builder *BsonRegistryBuilder)

type BsonRegistryBuilder

type BsonRegistryBuilder struct {
	*bsoncodec.RegistryBuilder
	// contains filtered or unexported fields
}

BsonRegistryBuilder initializes the mongo driver registry to encode/decode honoring the JSON struct tags. For example, a struct with the following JSON tags:

type Sample struct {
       FirstName string `json:"first_name"`
}

Will serialize the field to BSON as "first_name" instead of "firstname" (default naming strategy).

func NewBsonRegistryBuilder

func NewBsonRegistryBuilder() *BsonRegistryBuilder

func (*BsonRegistryBuilder) Build

func (b *BsonRegistryBuilder) Build()

Build sets this registry as the BSON default

func (*BsonRegistryBuilder) Register

Register a custom codec to the default BSON registry

func (*BsonRegistryBuilder) RegisterAll

func (b *BsonRegistryBuilder) RegisterAll(registrants ...BsonCodecsRegistrant) *BsonRegistryBuilder

RegisterAll register all the custom codecs to the default BSON registry

func (*BsonRegistryBuilder) RegisterTypeDecoder

func (b *BsonRegistryBuilder) RegisterTypeDecoder(t reflect.Type, dec bsoncodec.ValueDecoder)

func (*BsonRegistryBuilder) RegisterTypeEncoder added in v0.19.1

func (b *BsonRegistryBuilder) RegisterTypeEncoder(t reflect.Type, dec bsoncodec.ValueEncoder)

func (*BsonRegistryBuilder) StructCodec

func (b *BsonRegistryBuilder) StructCodec() *bsoncodec.StructCodec

StructCodec provides the configured bsoncodec.StructCodec in registry

Jump to

Keyboard shortcuts

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