podman
24 строки · 1013.0 Байт
1// Copyright (C) MongoDB, Inc. 2017-present.
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may
4// not use this file except in compliance with the License. You may obtain
5// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
7package bson8
9import "go.mongodb.org/mongo-driver/bson/bsoncodec"10
11// DefaultRegistry is the default bsoncodec.Registry. It contains the default codecs and the
12// primitive codecs.
13var DefaultRegistry = NewRegistryBuilder().Build()14
15// NewRegistryBuilder creates a new RegistryBuilder configured with the default encoders and
16// decoders from the bsoncodec.DefaultValueEncoders and bsoncodec.DefaultValueDecoders types and the
17// PrimitiveCodecs type in this package.
18func NewRegistryBuilder() *bsoncodec.RegistryBuilder {19rb := bsoncodec.NewRegistryBuilder()20bsoncodec.DefaultValueEncoders{}.RegisterDefaultEncoders(rb)21bsoncodec.DefaultValueDecoders{}.RegisterDefaultDecoders(rb)22primitiveCodecs.RegisterPrimitiveCodecs(rb)23return rb24}
25