mongohelper

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func CvtA added in v0.0.12

func CvtA[T any](a any) ([]T, error)

a must be primitive.A type

func CvtM added in v0.0.12

func CvtM[T any](m any) (map[string]T, error)

m must be primitive.M type

func Delete

func Delete[T any](rFilter io.Reader) (int, []*T, error)

return deleted count, original objects

func DeleteOne added in v0.0.8

func DeleteOne[T any](rFilter io.Reader) (int, *T, error)

return deleted count, original object

func Find

func Find[T any](rFilter io.Reader) (rt []*T, err error)

return found objects

func FindOne

func FindOne[T any](rFilter io.Reader) (*T, error)

return found object, if not found, return nil

func Insert

func Insert(rData io.Reader) (any, []byte, error)

return inserted id(s), inserted data

func ReplaceOne added in v0.0.11

func ReplaceOne(rFilter, rData io.Reader) (any, []byte, error)

return replaced count, after replacing data

func Update

func Update(rFilter, rUpdate io.Reader, one bool) (int, error)

return updated count

func UpdateMongoClient

func UpdateMongoClient(ip string, port int)

func Upsert added in v0.0.11

func Upsert(rData io.Reader, idField string, idValue any) (any, []byte, error)

if inserted, return id, inserted data if replaced, return count, after replacing data

func UseDbCol

func UseDbCol(dbName, colName string)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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