samplelib

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2021 License: MIT Imports: 6 Imported by: 0

README

samplelib

this code for sample for learn build library in go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOne

func AddOne(mdb *mongo.Database, i *Item) (*mongo.InsertOneResult, error)

func GetItem

func GetItem(rdb *redis.Client, key string) (string, error)

func GetOne

func GetOne(mdb *mongo.Database, i *Item, filter interface{}) error

func RemoveOne

func RemoveOne(mdb *mongo.Database, filter interface{}) (*mongo.DeleteResult, error)

func SetItem

func SetItem(rdb *redis.Client, key string, i *Item) error

func Update

func Update(mdb *mongo.Database, filter interface{}, update interface{}) (*mongo.UpdateResult, error)

Types

type Item

type Item struct {
	Name  string `json:"name" bson:"name"`
	Total int    `json:"total" bson:"total"`
	Id    string `json:"id" bson:"id"`
}

func Get

func Get(mdb *mongo.Database, filter interface{}) []*Item

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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