example

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Code generated by bsonq-gen. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressBuilder

type AddressBuilder[RT any] struct {
	bsonq.F[RT, dao.Address, dao.Address]
}

AddressBuilder allows for constructing type-safe queries on the Address struct. RT is the type of the root document.

func (AddressBuilder[RT]) City

func (b AddressBuilder[RT]) City() bsonq.StringF[RT, string, string]

City returns a builder for the City field.

func (AddressBuilder[RT]) Lines

func (b AddressBuilder[RT]) Lines() AddressLinesArrayBuilder[RT]

Lines returns a builder for the Lines field.

type AddressLinesArrayBuilder

type AddressLinesArrayBuilder[RT any] struct {
	bsonq.StringF[RT, []string, string]
	bsonq.ValueArrayF[RT, string, bsonq.StringV[string, string]]
}

AddressLinesArrayBuilder is a composite builder for the Lines field of Address. RT is the type of the root document.

type Collection

type Collection interface {
	UpdateMany(ctx context.Context,
		filter any, update any, opts ...options.Lister[options.UpdateManyOptions],
	) (*mongo.UpdateResult, error)
}

type CustomerBuilder

type CustomerBuilder[RT any] struct {
	bsonq.F[RT, dao.Customer, dao.Customer]
}

CustomerBuilder allows for constructing type-safe queries on the Customer struct. RT is the type of the root document.

func QCustomer

func QCustomer() CustomerBuilder[dao.Customer]

QCustomer is the main entry point to start a type-safe query for the Customer struct.

func (CustomerBuilder[RT]) Address

func (b CustomerBuilder[RT]) Address() AddressBuilder[RT]

Address returns a builder for the Address field.

func (CustomerBuilder[RT]) ID

func (b CustomerBuilder[RT]) ID() bsonq.F[RT, bson.ObjectID, bson.ObjectID]

ID returns a builder for the ID field.

func (CustomerBuilder[RT]) Name

func (b CustomerBuilder[RT]) Name() bsonq.StringF[RT, string, string]

Name returns a builder for the Name field.

func (CustomerBuilder[RT]) Orders

func (b CustomerBuilder[RT]) Orders() CustomerOrdersArrayBuilder[RT]

Orders returns a builder for the Orders field.

type CustomerCollection

type CustomerCollection struct {
	// contains filtered or unexported fields
}

abstraction over mongo.Collection with type-safe methods.

func NewCustomerCollection

func NewCustomerCollection(c Collection) *CustomerCollection

func (*CustomerCollection) CorrectCitySpelling

func (cc *CustomerCollection) CorrectCitySpelling(
	ctx context.Context, corrected string, wrongSpellings ...string,
) (int64, error)

type CustomerOrdersArrayBuilder

type CustomerOrdersArrayBuilder[RT any] struct {
	Customer_OrdersBuilder_forArrays[RT]
	bsonq.DocumentArrayF[RT, struct {
		ID    string      `bson:"orderId"`
		Items []dao.Items `bson:"items"`
	}, Customer_OrdersBuilderInterface[struct {
		ID    string      `bson:"orderId"`
		Items []dao.Items `bson:"items"`
	}]]
}

CustomerOrdersArrayBuilder is a composite builder for the Orders field of Customer. RT is the type of the root document.

type Customer_OrdersBuilderInterface

type Customer_OrdersBuilderInterface[RT any] interface {
	ID() bsonq.StringF[RT, string, string]
	Items() Customer_OrdersItemsArrayBuilder[RT]
}

Customer_OrdersBuilderInterface defines the methods available on the Customer_OrdersBuilder. It is used as a parameter in functions like ElemMatch to enforce type safety. RT is the type of the root document.

type Customer_OrdersBuilder_forArrays

type Customer_OrdersBuilder_forArrays[RT any] struct {
	bsonq.F[RT, []struct {
		ID    string      `bson:"orderId"`
		Items []dao.Items `bson:"items"`
	}, struct {
		ID    string      `bson:"orderId"`
		Items []dao.Items `bson:"items"`
	}]
}

Customer_OrdersBuilder_forArrays is used for constructing Customer_Orders, when it is used as an array element. RT is the type of the root document.

func (Customer_OrdersBuilder_forArrays[RT]) ID

ID returns a builder for the ID field when Customer_Orders is used as an array element.

func (Customer_OrdersBuilder_forArrays[RT]) Items

Items returns a builder for the Items field when Customer_Orders is used as an array element.

type Customer_OrdersItemsArrayBuilder

type Customer_OrdersItemsArrayBuilder[RT any] struct {
	ItemsBuilder_forArrays[RT]
	bsonq.DocumentArrayF[RT, dao.Items, ItemsBuilderInterface[dao.Items]]
}

Customer_OrdersItemsArrayBuilder is a composite builder for the Items field of Customer_Orders. RT is the type of the root document.

type ItemsBuilderInterface

type ItemsBuilderInterface[RT any] interface {
	ProductID() bsonq.StringF[RT, dao.PID, dao.PID]
	Quantity() bsonq.NumericF[RT, int, int]
	Size() bsonq.NumericF[RT, *int, *int]
}

ItemsBuilderInterface defines the methods available on the ItemsBuilder. It is used as a parameter in functions like ElemMatch to enforce type safety. RT is the type of the root document.

type ItemsBuilder_forArrays

type ItemsBuilder_forArrays[RT any] struct {
	bsonq.F[RT, []dao.Items, dao.Items]
}

ItemsBuilder_forArrays is used for constructing Items, when it is used as an array element. RT is the type of the root document.

func (ItemsBuilder_forArrays[RT]) ProductID

func (b ItemsBuilder_forArrays[RT]) ProductID() bsonq.StringF[RT, dao.PID, dao.PID]

ProductID returns a builder for the ProductID field when Items is used as an array element.

func (ItemsBuilder_forArrays[RT]) Quantity

func (b ItemsBuilder_forArrays[RT]) Quantity() bsonq.NumericF[RT, int, int]

Quantity returns a builder for the Quantity field when Items is used as an array element.

func (ItemsBuilder_forArrays[RT]) Size

func (b ItemsBuilder_forArrays[RT]) Size() bsonq.NumericF[RT, *int, *int]

Size returns a builder for the Size field when Items is used as an array element.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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