flannel

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeTransaction = `transaction`
	TypeAsset       = `asset`
	TypeParticipant = `participant`
)
View Source
const FLANNEL_CONSOLE = `flannel_console`
View Source
const (
	TAG = `flannel`
)

Variables

View Source
var (
	ErrCompileStruct     = errors.New(`error to compile interface is not a struct type In Create Function`)
	ErrTagPrimaryKey     = errors.New(`error to get a primary key in the struct. primary key is important to make a transaction`)
	ErrModelDefineSchema = errors.New(`error to mapping flannel 'Schema' to Model structure please check your model type`)
)
View Source
var (
	// ErrRecordNotFound returns a "record not found error". Occurs only when attempting to query the database with a struct; querying with a slice won't return this error
	ErrRecordNotFound   = errors.New("record not found")
	ErrExistKeyInLedger = errors.New("ledger is already exist this record")
)

Functions

func Console

func Console(c router.Context) (interface{}, error)

func Document

func Document(c router.Context) (interface{}, error)

func IsExistKeyInLedgerError

func IsExistKeyInLedgerError(err error) bool

func IsRecordNotFoundError

func IsRecordNotFoundError(err error) bool

IsRecordNotFoundError returns true if error contains a RecordNotFound error

func ObjectType

func ObjectType(stub *InitStubInterface) string

func Router

func Router(r *router.Group)

Types

type ChainCompositeKey

type ChainCompositeKey interface {
	Create(args ...string) ChainCompositeKey
	Error() error
	Find(filter []string, val *ChainList) ChainCompositeKey
}

type ChainList

type ChainList []interface{}

type CollectionInterface

type CollectionInterface struct {
	Name       string `json:"name"`
	ObjectType string `json:"object_type"`
}

type ConsoleInterface

type ConsoleInterface struct {
	Collections []CollectionInterface `json:"collections"`
}

type Flannel

type Flannel interface {
	Error() error

	Chain(string, string) Flannel

	Model(interface{}) Flannel

	// InvokeLedger : force to create state in ledger
	InvokeLedger(key string, arg interface{}) Flannel
	// Create : new create a ledger transaction
	Create(interface{}) Flannel
	// Exist : checking a state is existing
	Exist(id string) (bool, Flannel)
	// FindById : query a ledger by using key state
	FindById(id string, arg interface{}) Flannel
	FindByIdAndUpdate(id string, modify interface{}) Flannel

	// UpdateOne : update ledger state using struct in the same query
	UpdateOne(arg interface{}) Flannel

	// InitChainCompositeKey :
	InitChainCompositeKey(index ...string) ChainCompositeKey
}

func InitFlannel

func InitFlannel(c router.Context, stub *InitStubInterface) Flannel

type InitStubInterface

type InitStubInterface struct {
	ModelOrg  string
	ModelType string
	ModelName string
	Debug     *bool
}

type RequestDocumentInterface

type RequestDocumentInterface struct {
	Collection string `json:"collection"`
}

type Schema

type Schema struct {
	ObjectType           string `json:"object_type"`
	TransactionTimestamp int64  `json:"transaction_timestamp"`
	TransactionID        string `json:"transaction_id"`
}

Jump to

Keyboard shortcuts

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