db

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// value of status
	SyncTaskStatusUnHandled = "unhandled"
	SyncTaskStatusUnderway  = "underway"
	SyncTaskStatusCompleted = "completed"

	// only for follow task
	// when current_height of follow task add blockNumPerWorkerHandle
	// less than blockchain current_height, this follow task's status should be set invalid
	FollowTaskStatusInvalid = "invalid"

	// taskType
	SyncTaskTypeCatchUp = "catch_up"
	SyncTaskTypeFollow  = "follow"
)
View Source
const (
	CollectionNameTxn = "sync_mgo_txn"
)

Variables

This section is empty.

Functions

func Delete

func Delete(h Docs) error

func ExecCollection

func ExecCollection(collectionName string, s func(*mgo.Collection) error) error

get collection object

func Save

func Save(h Docs) error

func Start

func Start()

func Stop

func Stop()

func Txn

func Txn(ops []txn.Op) error

mgo transaction method detail to see: https://godoc.org/gopkg.in/mgo.v2/txn

func Update

func Update(h Docs) error

Types

type Docs

type Docs interface {
	// collection name
	Name() string
	// primary key pair(used to find a unique record)
	PkKvPair() map[string]interface{}
}

Jump to

Keyboard shortcuts

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