bsondoc

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package bsondoc builds on an existing bson doc according to the provided entity model schema.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(
	ctx context.Context,
	bsonDoc *bson.D,
	entityModelSchema *schema.EntityModelSchema,
	translateTo TranslateToEnum,
) error

Build builds on the given bson doc based on the provided schema.EntityModelSchema.

func GetFieldValueFromRootDoc

func GetFieldValueFromRootDoc(doc *bson.D, field string) interface{}

GetFieldValueFromRootDoc returns the value of the provided field (nil if not found) from the root of a bson doc.

Types

type TranslateToEnum

type TranslateToEnum string

TranslateToEnum is the enum for the type of translation to be done.

const (
	TranslateToEnumMongo       TranslateToEnum = "mongo"        // translate to mongo doc
	TranslateToEnumEntityModel TranslateToEnum = "entity_model" // translate to entity model
)

Jump to

Keyboard shortcuts

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