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: 0

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