store

package
v0.0.0-...-75eda33 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultMarshaling es el marshaling por defecto
	DefaultMarshaling = marshaling.JSON()

	// DefaultFiltering es el filtering por defecto
	DefaultFiltering = filtering.Copy()
)

Functions

This section is empty.

Types

type Collection

type Collection struct {
	Name        string
	Tag         string
	Field       string
	Creator     CreatorFunc
	Getter      GetterFunc
	Setter      SetterFunc
	Clear       MutatorFunc
	Collector   CollectorFunc
	Enumerator  EnumeratorFunc
	ItemCreator CreatorFunc
	// contains filtered or unexported fields
}

type CollectorFunc

type CollectorFunc func(tgt interface{}, i Item)

func MapCollector

func MapCollector() CollectorFunc

type Composite

type Composite struct {
	Name             string
	Creator          CreatorFunc
	Copier           CopierFunc
	IdentifierField  string
	IdentifierGetter GetterFunc
	IdentifierSetter SetterFunc
	IdentifierKey    KeyFunc
	KeyIdentifier    ValFunc
	KeyBaseName      string
	Singletons       []Singleton
	Collections      []Collection
	KeepRoot         bool
}

type CopierFunc

type CopierFunc func(src interface{}) (new interface{})

type CreatorFunc

type CreatorFunc func() (new interface{})

func ValueCreator

func ValueCreator(ref interface{}) CreatorFunc

type Entry

type Entry struct {
	Key   *key.Key
	Value interface{}
}

func (*Entry) String

func (e *Entry) String() string

type EnumeratorFunc

type EnumeratorFunc func(src interface{}) []Item

func MapEnumerator

func MapEnumerator() EnumeratorFunc

type GetterFunc

type GetterFunc func(src interface{}) interface{}

func FieldGetter

func FieldGetter(name string) GetterFunc

type Item

type Item struct {
	Identifier string
	Value      interface{}
}

func NewItem

func NewItem(id string, value interface{}) Item

type KeyFunc

type KeyFunc func(interface{}) (*key.Key, error)

type MemberError

type MemberError struct {
	Kind  string `json:"kind,omitempty"`
	Tag   string `json:"tag,omitempty"`
	ID    string `json:"id,omitempty"`
	Error string `json:"error,omitempty"`
}

type MutatorFunc

type MutatorFunc func(tgt interface{})

func FieldClear

func FieldClear(name string) MutatorFunc

type Option

type Option func(*simplestore)

func Options

func Options(stub shim.ChaincodeStubInterface) ([]Option, error)

func SetErrors

func SetErrors(b bool) Option

func SetFiltering

func SetFiltering(f filtering.Filtering) Option

func SetMarshaling

func SetMarshaling(m marshaling.Marshaling) Option

func SetSep

func SetSep(sep *key.Sep) Option

type Range

type Range struct {
	First interface{}
	Last  interface{}
}

func R

func R(first, last interface{}) *Range

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

func MustPrepare

func MustPrepare(com Composite) *Schema

func Prepare

func Prepare(com Composite) (*Schema, error)

func (*Schema) Cleared

func (cc *Schema) Cleared(v interface{}) interface{}

func (*Schema) Collection

func (cc *Schema) Collection(tag string) *Collection

func (*Schema) CollectionEntries

func (cc *Schema) CollectionEntries(collection *Collection, valkey *key.Key, col interface{}) []*Entry

func (*Schema) Collections

func (cc *Schema) Collections() []*Collection

func (*Schema) CollectionsEntries

func (cc *Schema) CollectionsEntries(val interface{}) (entries []*Entry, err error)

func (*Schema) Copy

func (cc *Schema) Copy(v interface{}) interface{}

func (*Schema) Create

func (cc *Schema) Create() (v interface{}, err error)

func (*Schema) IdentifierKey

func (cc *Schema) IdentifierKey(id interface{}) (k *key.Key, err error)

func (*Schema) IdentifierWitness

func (cc *Schema) IdentifierWitness(id interface{}) (*Entry, error)

func (*Schema) IsWitnessKey

func (cc *Schema) IsWitnessKey(key *key.Key) bool

func (*Schema) KeyBaseName

func (cc *Schema) KeyBaseName() string

func (*Schema) KeyIdentifier

func (cc *Schema) KeyIdentifier(k *key.Key) (v interface{}, err error)

func (*Schema) KeyWitness

func (cc *Schema) KeyWitness(key *key.Key) *key.Key

func (*Schema) MustKeepRoot

func (cc *Schema) MustKeepRoot(val interface{}) bool

func (*Schema) Name

func (cc *Schema) Name() string

func (*Schema) RootEntry

func (cc *Schema) RootEntry(val interface{}) (entry *Entry, err error)

func (*Schema) SetIdentifier

func (cc *Schema) SetIdentifier(val, id interface{}) (err error)

func (*Schema) Singleton

func (cc *Schema) Singleton(tag string) *Singleton

func (*Schema) Singletons

func (cc *Schema) Singletons() []*Singleton

func (*Schema) SingletonsEntries

func (cc *Schema) SingletonsEntries(val interface{}) (entries []*Entry, err error)

func (*Schema) ValueIdentifier

func (cc *Schema) ValueIdentifier(val interface{}) (id interface{}, err error)

func (*Schema) ValueKey

func (cc *Schema) ValueKey(val interface{}) (*key.Key, error)

func (*Schema) ValueWitness

func (cc *Schema) ValueWitness(val interface{}) (*Entry, error)

type SetterFunc

type SetterFunc func(tgt interface{}, v interface{})

func FieldSetter

func FieldSetter(name string) SetterFunc

type Singleton

type Singleton struct {
	Name    string
	Tag     string
	Field   string
	Creator CreatorFunc
	Getter  GetterFunc
	Setter  SetterFunc
	Clear   MutatorFunc
	// contains filtered or unexported fields
}

type Store

type Store interface {
	PutComposite(s *Schema, val interface{}) error
	GetComposite(s *Schema, id interface{}) (interface{}, error)
	HasComposite(s *Schema, id interface{}) (bool, error)
	DelComposite(s *Schema, id interface{}) error

	GetCompositeAll(s *Schema) ([]interface{}, error)

	GetCompositeRange(s *Schema, r *Range) ([]interface{}, error)
	DelCompositeRange(s *Schema, r *Range) ([]interface{}, error)

	PutCompositeSingleton(s *Singleton, id interface{}, val interface{}) error
	GetCompositeSingleton(s *Singleton, id interface{}) (interface{}, error)

	PutCompositeCollection(c *Collection, id interface{}, col interface{}) error
	GetCompositeCollection(c *Collection, id interface{}) (interface{}, error)

	PutCompositeCollectionItem(c *Collection, id interface{}, itemid string, val interface{}) error
	GetCompositeCollectionItem(c *Collection, id interface{}, itemid string) (interface{}, error)
	DelCompositeCollectionItem(c *Collection, id interface{}, itemid string) error

	PutValue(key *key.Key, val interface{}) error
	GetValue(key *key.Key, val interface{}) (bool, error)
	HasValue(key *key.Key) (bool, error)
	DelValue(key *key.Key) error
}

func New

func New(stub shim.ChaincodeStubInterface, opts ...Option) Store

type ValFunc

type ValFunc func(*key.Key) (interface{}, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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