P3

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: MIT Imports: 10 Imported by: 0

README

P3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteOneDoc

func DeleteOneDoc(db *mongo.Database, col string, filter bson.M) (err error)

func GCFReturnStruct

func GCFReturnStruct(DataStuct any) string

func GetAllData

func GetAllData(MONGOCONNSTRINGENV, dbname, collectionname string) string

func GetAllDocs

func GetAllDocs(db *mongo.Database, col string, docs interface{}) interface{}

func InsertDataProduk

func InsertDataProduk(Mongoenv, dbname string, r *http.Request) string

func InsertOneDoc

func InsertOneDoc(db *mongo.Database, col string, docs interface{}) (insertedID primitive.ObjectID, err error)

func InsertProduk

func InsertProduk(db *mongo.Database, col string, produkdata Produk) (insertedID primitive.ObjectID, err error)

func SetConnection

func SetConnection(MONGOCONNSTRINGENV, dbname string) *mongo.Database

func UpdateOneDoc

func UpdateOneDoc(db *mongo.Database, col string, filter, update interface{}) (err error)

Types

type Credential

type Credential struct {
	Status  bool     `json:"status" bson:"status"`
	Token   string   `json:"token,omitempty" bson:"token,omitempty"`
	Message string   `json:"message,omitempty" bson:"message,omitempty"`
	Data    []Produk `bson:"data,omitempty" json:"data,omitempty"`
}

type Produk

type Produk struct {
	ID        primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	Nama      string             `bson:"nama,omitempty" json:"nama,omitempty"`
	Harga     string             `bson:"harga,omitempty" json:"harga,omitempty"`
	Deskripsi string             `bson:"deskripsi,omitempty" json:"deskripsi,omitempty"`
	Stok      string             `bson:"stok,omitempty" json:"stok,omitempty"`
	Image_URL string             `bson:"image_url,omitempty" json:"image_url,omitempty"`
}

func GetAllDataProduk

func GetAllDataProduk(db *mongo.Database, col string) (produklist []Produk)

Jump to

Keyboard shortcuts

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