mdb

package
v0.0.0-...-6f82975 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DbName = "fiberdb"
)

Const

View Source
const (
	TableNId = "nlidgen"
)

Const

Variables

View Source
var FiberDB *mongo.Database
View Source
var MClient *mongo.Client

Functions

func InitMongo

func InitMongo()

Init mongo client https://pkg.go.dev/go.mongodb.org/mongo-driver/mongo#Connect mongodb://localhost:27017 mongodb://localhost:27017,localhost:27018/?replicaSet=replset mongodb://user:password@localhost:27017

func MClose

func MClose()

func Next

func Next(id string) (int64, error)

Next generate a auto increment version ID for the given key

func ResetID

func ResetID(id string, value int64) (int64, error)

ResetID reset id gen to value

Types

type NId

type NId struct {
	ID  string `bson:"_id" json:"id"`
	Seq int64  `bson:"seq" json:"seq"`
}

NId is long id gen

func (NId) String

func (id NId) String() string

Jump to

Keyboard shortcuts

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