crud

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count[T any](
	ctx context.Context,
	collection *mongo.Collection,
	filterInput T) (int64, error)

Count count ressource with provided filters

func Create

func Create[T any](ctx context.Context, collection *mongo.Collection, data T) (*T, error)

Create create the data in collection using provided DAO

func DeleteByID

func DeleteByID(ctx context.Context, collection *mongo.Collection, id primitive.ObjectID) error

DeleteByID delete data by id

func Find

func Find[T any, TFilter any](ctx context.Context,

	collection *mongo.Collection,
	f TFilter,
	pagination paging.StdPaging,
) ([]T, error)

Find find user based on provided filters

func GetByID

func GetByID[T any](ctx context.Context, collection *mongo.Collection, id primitive.ObjectID) (*T, error)

GetByID get data by id

func Update

func Update[T any](ctx context.Context,

	collection *mongo.Collection,
	id primitive.ObjectID,
	in T) (*T, error)

Update update a data in DB

Types

This section is empty.

Jump to

Keyboard shortcuts

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