helpers

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func DeleteDoc

func DeleteDoc(db *mongo.Database, collection string, filter bson.M) (result *mongo.DeleteResult)

func DeleteOneDoc

func DeleteOneDoc(db *mongo.Database, collection string, filter bson.M) (result *mongo.DeleteResult)

func DocExists

func DocExists[T any](db *mongo.Database, collname string, filter bson.M, doc T) (result bool)

func GetAllDistinctDoc

func GetAllDistinctDoc(db *mongo.Database, filter bson.M, fieldname, collection string) (doc []any)

func GetAllDoc

func GetAllDoc[T any](db *mongo.Database, collection string) (doc []T, err error)

func GetAllDocByFilter

func GetAllDocByFilter[T any](db *mongo.Database, collection string, filter bson.M) (doc []T, err error)

func GetAllDocByFilterWithPagination

func GetAllDocByFilterWithPagination[T any](db *mongo.Database, collection string, page, limit int, filter bson.M) (doc []T, datacount models.DataCount, err error)

func GetAllDocWithPagination

func GetAllDocWithPagination[T any](db *mongo.Database, collection string, page, limit int) (doc []T, datacount models.DataCount, err error)

func GetDataForDashboard added in v1.0.6

func GetDataForDashboard[T any](db *mongo.Database, collection, no_pend, kode_pelanggan string, page, limit int, startDate, endDate time.Time) (docs []T, datacount models.DataCount, err error)

func GetDocTesting added in v1.1.1

func GetDocTesting[T any](db *mongo.Database, collection string, limit int, filter bson.M) (doc []T, err error)

func GetOneDoc

func GetOneDoc[T any](db *mongo.Database, collection string, filter bson.M) (doc T)

func GetOneLatestDoc

func GetOneLatestDoc[T any](db *mongo.Database, collection string, filter bson.M) (doc T, err error)

func GetRandomDoc

func GetRandomDoc[T any](db *mongo.Database, collection string, size uint) (result []T, err error)

func HashPassword

func HashPassword(password string) (string, error)

func InsertOneDoc

func InsertOneDoc(db *mongo.Database, collection string, doc interface{}) (insertedID interface{}, err error)

func MongoConnect

func MongoConnect(mconn models.DBInfo) *mongo.Database

func ReplaceOneDoc

func ReplaceOneDoc(db *mongo.Database, collection string, filter bson.M, doc interface{}) (updatereseult *mongo.UpdateResult)

Types

This section is empty.

Jump to

Keyboard shortcuts

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