Documentation ¶
Index ¶
- Variables
- func BenchmarksRun(db *Cluster)
- func Complex128(i complex128) []byte
- func Distance(lat1, lon1, lat2, lon2 float64) float64
- func FetchRange(tr fdb.ReadTransaction, needed []fdb.RangeResult) ([][]fdb.KeyValue, error)
- func ID64() (id int64)
- func Int(i int) []byte
- func Int32(i int32) []byte
- func Int64(i int64) []byte
- func TestsCheck() []string
- func TestsRun(db *Cluster)
- func ToInt(b []byte) int
- func ToInt32(b []byte) int32
- func ToInt64(b []byte) int64
- type Chain
- type Cluster
- type ClusterStatus
- type Counter
- type Directory
- func (d *Directory) Clear() error
- func (d *Directory) Multi() *MultiChain
- func (d *Directory) Object(name string, schemeObj interface{}) *ObjectBuilder
- func (d *Directory) Parallel(tasks ...PromiseAny) *Transaction
- func (d *Directory) Read(callback func(*Transaction)) *Transaction
- func (d *Directory) Write(callback func(*Transaction)) *Transaction
- type Field
- func (f *Field) BytesFromObject(objectValue interface{}) ([]byte, error)
- func (f *Field) GenerateID() []byte
- func (f *Field) GetDefault() interface{}
- func (f *Field) ParseTag() *Tag
- func (f *Field) SetAutoIncrement()
- func (f *Field) SetID(idType GenIDType)
- func (f *Field) ToBytes(val interface{}) ([]byte, error)
- func (f *Field) ToInterface(obj []byte) interface{}
- type GenIDType
- type Index
- func (i *Index) ClearAll() error
- func (i *Index) Delete(tr fdb.Transaction, primaryTuple tuple.Tuple, key tuple.Tuple)
- func (i *Index) Options(options ...IndexOption)
- func (i *Index) Reindex()
- func (i *Index) ReindexUnsafe(data interface{}) *PromiseErr
- func (i *Index) SetOption(option IndexOption)
- func (i *Index) Write(tr fdb.Transaction, primaryTuple tuple.Tuple, input, oldObject *Struct) error
- type IndexGeo
- type IndexOption
- type IndexSearch
- type Key
- type KeyElement
- type KeyTuple
- type MultiChain
- type Object
- func (o *Object) Add(data interface{}) *PromiseErr
- func (o *Object) Clear() error
- func (o *Object) ClearAllIndexes() error
- func (o *Object) Delete(objOrID interface{}) *PromiseErr
- func (o *Object) Get(objectPtr interface{}) *PromiseErr
- func (o *Object) GetBy(objectPtr interface{}, indexKeys ...string) *PromiseErr
- func (o *Object) GetField(objectPtr interface{}, fieldName string) *PromiseErr
- func (o *Object) IncFieldUnsafe(objOrID interface{}, fieldName string, incVal interface{}) *PromiseErr
- func (o *Object) IncGetField(objOrID interface{}, fieldName string, incVal interface{}) *Promise
- func (o *Object) List(primary ...interface{}) *Query
- func (o *Object) ListAll() *Query
- func (o *Object) Migrate(migrateTo *Object)
- func (o *Object) MultiGet(sliceObjectPtr interface{}) *PromiseErr
- func (o *Object) Reindex()
- func (o *Object) Set(objectPtr interface{}) *PromiseErr
- func (o *Object) SetField(objectPtr interface{}, fieldName string) *PromiseErr
- func (o *Object) Update(data interface{}, callback func() error) *PromiseErr
- func (o *Object) UpdateField(objOrID interface{}, fieldName string, ...) *Promise
- func (o *Object) Use(indexFieldNames ...string) *Query
- func (o *Object) Write(data interface{}) *PromiseErr
- type ObjectBuilder
- func (ob *ObjectBuilder) AutoIncrement(name string) *ObjectBuilder
- func (ob *ObjectBuilder) Counter(fieldNames ...string) *Counter
- func (ob *ObjectBuilder) Done() *Object
- func (ob *ObjectBuilder) FastIndex(names ...string) *ObjectBuilder
- func (ob *ObjectBuilder) IDDate(fieldName string) *ObjectBuilder
- func (ob *ObjectBuilder) IDRandom(fieldName string) *ObjectBuilder
- func (ob *ObjectBuilder) Index(names ...string) *ObjectBuilder
- func (ob *ObjectBuilder) IndexCustom(key string, cb func(object interface{}) KeyTuple) *Index
- func (ob *ObjectBuilder) IndexGeo(latKey string, longKey string, geoPrecision int) *IndexGeo
- func (ob *ObjectBuilder) IndexOptional(names ...string) *ObjectBuilder
- func (ob *ObjectBuilder) IndexSearch(key string, options ...IndexOption) *IndexSearch
- func (ob *ObjectBuilder) N2N(client *ObjectBuilder, name string) *Relation
- func (ob *ObjectBuilder) Primary(names ...string) *ObjectBuilder
- func (ob *ObjectBuilder) Unique(names ...string) *ObjectBuilder
- func (ob *ObjectBuilder) UniqueOptional(names ...string) *ObjectBuilder
- type Promise
- type PromiseAny
- type PromiseErr
- type PromiseSlice
- func (p *PromiseSlice) CheckAll(t *Transaction, slicePointer interface{})
- func (p *PromiseSlice) Do(t *Transaction) *PromiseSlice
- func (p *PromiseSlice) Limit(limit int) *PromiseSlice
- func (p *PromiseSlice) Reverse(reverse bool) *PromiseSlice
- func (p *PromiseSlice) ScanAll(slicePointer interface{}) error
- func (p *PromiseSlice) Slice() *Slice
- func (p *PromiseSlice) TryAll(t *Transaction, slicePointer interface{})
- type PromiseValue
- type Query
- func (q *Query) Do(tr *Transaction) *PromiseSlice
- func (q *Query) From(values ...interface{}) *Query
- func (q *Query) Limit(limit int) *Query
- func (q *Query) List(values ...interface{}) *Query
- func (q *Query) Next() bool
- func (q *Query) OnlyPrimary() *Query
- func (q *Query) Promise() *PromiseSlice
- func (q *Query) Reverse() *Query
- func (q *Query) ScanAll(slicePointer interface{}) error
- func (q *Query) SetReverse(reverse bool) *Query
- func (q *Query) Slice() *Slice
- func (q *Query) To(values ...interface{}) *Query
- func (q *Query) TryAll(tr *Transaction, slicePointer interface{})
- func (q *Query) Use(indexFieldNames ...string) *Query
- type Relation
- func (r *Relation) Add(hostOrID interface{}, clientOrID interface{}) *PromiseErr
- func (r *Relation) Check(hostOrID interface{}, clientOrID interface{}) *Promise
- func (r *Relation) Clear() error
- func (r *Relation) ClientData(fieldName string)
- func (r *Relation) Counter(on bool)
- func (r *Relation) CounterClient(object *ObjectBuilder, fieldName string)
- func (r *Relation) Delete(hostOrID interface{}, clientOrID interface{}) *PromiseErr
- func (r *Relation) FillClientData(hostOrID interface{}, client interface{}) *PromiseErr
- func (r *Relation) FillHostData(host interface{}, clientOrID interface{}) *PromiseErr
- func (r *Relation) GetClientData(hostOrID interface{}, clientOrID interface{}) *PromiseValue
- func (r *Relation) GetClientDataIDs(hostOrID interface{}, clientOrID interface{}) ([]byte, error)
- func (r *Relation) GetClientIDs(objOrID interface{}, from interface{}, limit int) *SliceIDs
- func (r *Relation) GetClients(objOrID interface{}, from interface{}) *PromiseSlice
- func (r *Relation) GetClientsCount(hostOrID interface{}) *Promise
- func (r *Relation) GetHostData(hostOrID interface{}, clientOrID interface{}) *PromiseValue
- func (r *Relation) GetHostIDs(objOrID interface{}, from interface{}, limit int) *SliceIDs
- func (r *Relation) GetHosts(objOrID interface{}, from interface{}) *PromiseSlice
- func (r *Relation) GetHostsCount(clientOrID interface{}) *Promise
- func (r *Relation) HostData(fieldName string)
- func (r *Relation) Set(hostOrID interface{}, clientOrID interface{}) *PromiseErr
- func (r *Relation) SetClientData(hostOrID interface{}, clientObj interface{}) *Promise
- func (r *Relation) SetData(hostObj interface{}, clientObj interface{}) *Promise
- func (r *Relation) SetHostData(hostObj interface{}, clientOrID interface{}) *Promise
- func (r *Relation) SetHostsCounterUnsafe(clientObject interface{}, count int64) error
- func (r *Relation) UpdateClientData(hostObj interface{}, clientObj interface{}, callback func()) *Promise
- func (r *Relation) UpdateData(hostObj interface{}, clientObj interface{}, callback func()) *Promise
- func (r *Relation) UpdateHostData(hostObj interface{}, clientObj interface{}, callback func()) *Promise
- type Slice
- type SliceIDs
- type Struct
- type Tag
- type Transaction
- type Value
Constants ¶
This section is empty.
Variables ¶
var AssertErrors = []string{}
AssertErrors list of errors
var AssertMux sync.Mutex
AssertMux mutex for errors
var ErrAlreadyExist = errors.New("This object already exist")
ErrAlreadyExist Object with this primary index or one of unique indexes already
var ErrDataCorrupt = errors.New("Data corrupt")
ErrDataCorrupt incorrect data sent
var ErrNotFound = errors.New("Document not found")
ErrNotFound is an error returned when no rows was found
var ErrSkip = errors.New("Operation was skipped")
ErrSkip returned in cases when it is necessary to skip operation without cancelling underlying transactions
var Nan = []byte{}
Nan means no data presented
var RelationN2N = 1
RelationN2N is main type of relation
Functions ¶
func BenchmarksRun ¶
func BenchmarksRun(db *Cluster)
BenchmarksRun runs benchmarks for STORED FoundationDB layer
func Distance ¶
Distance function returns the distance (in meters) between two points of
a given longitude and latitude relatively accurately (using a spherical approximation of the Earth) through the Haversin Distance Formula for great arc distance on a sphere with accuracy for small distances
point coordinates are supplied in degrees and converted into rad. in the func
distance returned in meters
func FetchRange ¶
func FetchRange(tr fdb.ReadTransaction, needed []fdb.RangeResult) ([][]fdb.KeyValue, error)
FetchRange will fetch list of range results
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster is the main struct for handling work with fdb
func (*Cluster) Status ¶
func (c *Cluster) Status() (*ClusterStatus, error)
Status will return fdb cluster status
type ClusterStatus ¶
type ClusterStatus struct { Client struct { ClusterFile struct { Path string `json:"path"` UpToDate bool `json:"up_to_date"` } `json:"cluster_file"` Coordinators struct { Coordinators []struct { Address string `json:"address"` Reachable bool `json:"reachable"` } `json:"coordinators"` QuorumReachable bool `json:"quorum_reachable"` } `json:"coordinators"` DatabaseStatus struct { Available bool `json:"available"` Healthy bool `json:"healthy"` } `json:"database_status"` Messages []struct { Description string `json:"description"` Name string `json:"name"` } `json:"messages"` } `json:"client"` }
ClusterStatus is status command fdb format
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter allow you to operate different counters inside your object
type Directory ¶
type Directory struct { Name string Cluster *Cluster Subspace directory.DirectorySubspace // contains filtered or unexported fields }
Directory is wrapper around foundation db directories, main entry point for working with STORED
func (*Directory) Multi ¶
func (d *Directory) Multi() *MultiChain
Multi creates reference object for multi requests
func (*Directory) Object ¶
func (d *Directory) Object(name string, schemeObj interface{}) *ObjectBuilder
Object declares new object for document layer
func (*Directory) Parallel ¶
func (d *Directory) Parallel(tasks ...PromiseAny) *Transaction
Parallel will create read transaction to perform multi gets
func (*Directory) Read ¶
func (d *Directory) Read(callback func(*Transaction)) *Transaction
Read will run callback in read transaction
func (*Directory) Write ¶
func (d *Directory) Write(callback func(*Transaction)) *Transaction
Write will run callback in write transaction
type Field ¶
type Field struct { Name string Num int Kind reflect.Kind SubKind reflect.Kind Type reflect.StructField Value reflect.Value AutoIncrement bool GenID GenIDType // type of ID autogeneration, IDDate, IDRandom UnStored bool // means this field would not be stored inside main object // contains filtered or unexported fields }
Field is main field structure
func (*Field) BytesFromObject ¶
BytesFromObject return bytes using full object instead of field value
func (*Field) GenerateID ¶
GenerateID will return ID bytes for type specified
func (*Field) GetDefault ¶
func (f *Field) GetDefault() interface{}
GetDefault return default value for this field
func (*Field) SetAutoIncrement ¶
func (f *Field) SetAutoIncrement()
SetAutoIncrement checks if everything ok for autoincrements
func (*Field) ToInterface ¶
ToInterface decodes field value
type Index ¶
type Index struct { Name string Unique bool Geo int // geo precision used to // contains filtered or unexported fields }
Index represend all indexes sored has
func (*Index) Options ¶
func (i *Index) Options(options ...IndexOption)
Options allow to set list of options
func (*Index) ReindexUnsafe ¶
func (i *Index) ReindexUnsafe(data interface{}) *PromiseErr
ReindexUnsafe will update index info (NOT consistency safe function) this function will use data provited by th object so should be used with care
func (*Index) SetOption ¶
func (i *Index) SetOption(option IndexOption)
SetOption allow to set option
type IndexGeo ¶
type IndexGeo struct {
// contains filtered or unexported fields
}
IndexGeo does all the Index does but also geo
type IndexOption ¶
type IndexOption struct { // CheckHandler describes should index be written for specific object or not CheckHandler func(obj interface{}) bool }
IndexOption is in option struct which allow to set differnt options
type IndexSearch ¶
type IndexSearch struct {
// contains filtered or unexported fields
}
IndexSearch provide substring search index for strings. That means you can search by part of the word this index is fast but could leave significant memory footpring on your database
func (*IndexSearch) ClearAll ¶
func (is *IndexSearch) ClearAll() error
ClearAll will remove index data
func (*IndexSearch) Search ¶
func (is *IndexSearch) Search(name string) *PromiseSlice
Search is main function to search using search index
type KeyElement ¶
type KeyElement interface{}
A KeyElement is one of the types that may be encoded in FoundationDB tuples. Although the Go compiler cannot enforce this, it is a programming error to use an unsupported types as a KeyElement (and will typically result in a runtime panic).
The valid types for KeyElement are []byte (or fdb.KeyConvertible), string, int64 (or int), float, double, bool, UUID, Tuple, and nil.
type MultiChain ¶
type MultiChain struct {
// contains filtered or unexported fields
}
MultiChain allow to select multiple objects simultaniusly
func (*MultiChain) Get ¶
func (m *MultiChain) Get(o *Object, objOrID interface{}) *Value
Get wiil get all objects with this object
func (*MultiChain) Need ¶
func (m *MultiChain) Need(o *Object, objOrID interface{}) *Value
Need means this object should be fetched
type Object ¶
type Object struct { Relations []*Relation // contains filtered or unexported fields }
Object is an abstraction for working with objects
func (*Object) Add ¶
func (o *Object) Add(data interface{}) *PromiseErr
Add writes data even in primary key is empty, by setting it. Take a look at autoincrement tag
func (*Object) ClearAllIndexes ¶
ClearAllIndexes clears all indexes data
func (*Object) Delete ¶
func (o *Object) Delete(objOrID interface{}) *PromiseErr
Delete removes data
func (*Object) Get ¶
func (o *Object) Get(objectPtr interface{}) *PromiseErr
Get fetch object using primary id
func (*Object) GetBy ¶
func (o *Object) GetBy(objectPtr interface{}, indexKeys ...string) *PromiseErr
GetBy fetch one row using index bye name or name of the index field
func (*Object) GetField ¶
func (o *Object) GetField(objectPtr interface{}, fieldName string) *PromiseErr
GetField will fill fetch the mutable field data, and fill the passed object
func (*Object) IncFieldUnsafe ¶
func (o *Object) IncFieldUnsafe(objOrID interface{}, fieldName string, incVal interface{}) *PromiseErr
IncFieldUnsafe increment field of an object does not implement indexes in the moment would not increment field of passed object, take care
func (*Object) IncGetField ¶
IncGetField increment field and return new value moved to IncFieldAtomic
func (*Object) List ¶
List queries list of items using primary key subspace. Pass no params if fetching all objects
func (*Object) ListAll ¶
ListAll queries list all items inside. Pass no params if fetching all objects
func (*Object) MultiGet ¶
func (o *Object) MultiGet(sliceObjectPtr interface{}) *PromiseErr
MultiGet fetch list of objects using primary id
func (*Object) Reindex ¶
func (o *Object) Reindex()
Reindex will go around all data and delete add every row
func (*Object) Set ¶
func (o *Object) Set(objectPtr interface{}) *PromiseErr
Set writes data, would return error if primary key is empty
func (*Object) SetField ¶
func (o *Object) SetField(objectPtr interface{}, fieldName string) *PromiseErr
SetField sets any value to requested field
func (*Object) Update ¶
func (o *Object) Update(data interface{}, callback func() error) *PromiseErr
Update writes data, only if row already exist
func (*Object) UpdateField ¶
func (o *Object) UpdateField(objOrID interface{}, fieldName string, callback func(value interface{}) (interface{}, error)) *Promise
UpdateField updates object field via callback with old value moved to ChangeField
func (*Object) Write ¶
func (o *Object) Write(data interface{}) *PromiseErr
Write writes data, only if row already exist
type ObjectBuilder ¶
type ObjectBuilder struct {
// contains filtered or unexported fields
}
ObjectBuilder is main interface to declare objects
func (*ObjectBuilder) AutoIncrement ¶
func (ob *ObjectBuilder) AutoIncrement(name string) *ObjectBuilder
AutoIncrement make defined field autoincremented before adding new objects
func (*ObjectBuilder) Counter ¶
func (ob *ObjectBuilder) Counter(fieldNames ...string) *Counter
Counter will count all objects with same value of passed fields
func (*ObjectBuilder) FastIndex ¶
func (ob *ObjectBuilder) FastIndex(names ...string) *ObjectBuilder
FastIndex will set index storing copy of object, performing denormalisation
func (*ObjectBuilder) IDDate ¶
func (ob *ObjectBuilder) IDDate(fieldName string) *ObjectBuilder
IDDate is unique id generated using date as first part, this approach is usefull if date index necessary too field type should be int64
func (*ObjectBuilder) IDRandom ¶
func (ob *ObjectBuilder) IDRandom(fieldName string) *ObjectBuilder
IDRandom is unique id generated using random number, this approach is usefull if you whant randomly distribute objects, and you do not whant to unveil data object
func (*ObjectBuilder) Index ¶
func (ob *ObjectBuilder) Index(names ...string) *ObjectBuilder
Index add an simple index for specific key or set of keys
func (*ObjectBuilder) IndexCustom ¶
func (ob *ObjectBuilder) IndexCustom(key string, cb func(object interface{}) KeyTuple) *Index
IndexCustom add an custom index generated dynamicly using callback function custom indexes in an general way to implement any index on top of it
func (*ObjectBuilder) IndexGeo ¶
func (ob *ObjectBuilder) IndexGeo(latKey string, longKey string, geoPrecision int) *IndexGeo
IndexGeo will add and geohash based index to allow geographicly search objects geoPrecision 0 means full precision: 10 < 1m, 9 ~ 7.5m, 8 ~ 21m, 7 ~ 228m, 6 ~ 1.8km, 5 ~ 7.2km, 4 ~ 60km, 3 ~ 234km, 2 ~ 1890km, 1 ~ 7500km
func (*ObjectBuilder) IndexOptional ¶
func (ob *ObjectBuilder) IndexOptional(names ...string) *ObjectBuilder
IndexOptional is the simple index which will be written only if field is not empty
func (*ObjectBuilder) IndexSearch ¶
func (ob *ObjectBuilder) IndexSearch(key string, options ...IndexOption) *IndexSearch
IndexSearch will add serchable index which will allow
func (*ObjectBuilder) N2N ¶
func (ob *ObjectBuilder) N2N(client *ObjectBuilder, name string) *Relation
N2N Creates object to object relation between current object and other one. Other words it represents relations when unlimited number of host objects connected to unlimited amount of client objects
func (*ObjectBuilder) Primary ¶
func (ob *ObjectBuilder) Primary(names ...string) *ObjectBuilder
Primary sets primary field in case it wasnot set with annotations
func (*ObjectBuilder) Unique ¶
func (ob *ObjectBuilder) Unique(names ...string) *ObjectBuilder
Unique index: if object with same field value already presented, Set and Add will return an ErrAlreadyExist
func (*ObjectBuilder) UniqueOptional ¶
func (ob *ObjectBuilder) UniqueOptional(names ...string) *ObjectBuilder
UniqueOptional index: if object with same field value already presented, Set and Add will return an ErrAlreadyExist If the value is empty index do not set
type Promise ¶
type Promise struct {
// contains filtered or unexported fields
}
Promise is an basic promise object
func (*Promise) After ¶
func (p *Promise) After(do func() PromiseAny) *Promise
After will perform an additional promise right after current one will be finised This works in transactions as well as in standalone promises, child promise will be executed in same transaction as parent
func (*Promise) Check ¶
func (p *Promise) Check(t *Transaction)
Check will perform promise in parallel with other promises whithin transaction without returning the result. But if Promise will return error full transaction will be cancelled and error will be returned
func (*Promise) Do ¶
func (p *Promise) Do(t *Transaction) *Promise
Do will attach promise to transaction, so promise will be called within passed transaction Promise should be inside an transaction callback, because transaction could be resent
func (*Promise) Try ¶
func (p *Promise) Try(t *Transaction)
Try will perform promise in parallel with other promises within transaction without returning the result. But if Promise will return error, transaction will be performed as everythig is ok, error will be ignored
type PromiseAny ¶
type PromiseAny interface {
// contains filtered or unexported methods
}
PromiseAny describes any type of promise
type PromiseErr ¶
type PromiseErr struct {
Promise
}
PromiseErr is implements everything promise implements but more
func (*PromiseErr) Do ¶
func (p *PromiseErr) Do(t *Transaction) *PromiseErr
Do will attach promise to transaction, so promise will be called within passed transaction Promise should be inside an transaction callback, because transaction could be resent
type PromiseSlice ¶
type PromiseSlice struct { Promise // contains filtered or unexported fields }
PromiseSlice is implements everything promise implements but more
func (*PromiseSlice) CheckAll ¶
func (p *PromiseSlice) CheckAll(t *Transaction, slicePointer interface{})
CheckAll will perform promise in parallel with other promises whithin transaction without returning the result. But if Promise will return error full transaction will be cancelled and error will be returned. Only when promise will be finished – slicePointer will be filled with data.
func (*PromiseSlice) Do ¶
func (p *PromiseSlice) Do(t *Transaction) *PromiseSlice
Do will attach promise to transaction, so promise will be called within passed transaction Promise should be inside an transaction callback, because transaction could be resent
func (*PromiseSlice) Limit ¶
func (p *PromiseSlice) Limit(limit int) *PromiseSlice
Limit is meant to set limit of the query this
func (*PromiseSlice) Reverse ¶
func (p *PromiseSlice) Reverse(reverse bool) *PromiseSlice
Reverse allow to reverse value of slice query if querying function support this
func (*PromiseSlice) ScanAll ¶
func (p *PromiseSlice) ScanAll(slicePointer interface{}) error
ScanAll values inside promise
func (*PromiseSlice) TryAll ¶
func (p *PromiseSlice) TryAll(t *Transaction, slicePointer interface{})
TryAll will perform promise in parallel with other promises within transaction without returning the result. But if Promise will return error, transaction will be performed as everythig is ok, error will be ignored. Only when promise will be finished – slicePointer will be filled with data.
type PromiseValue ¶
type PromiseValue struct {
Promise
}
PromiseValue is implements everything promise implements but also values
func (*PromiseValue) Do ¶
func (p *PromiseValue) Do(t *Transaction) *PromiseValue
Do will attach promise to transaction, so promise will be called within passed transaction Promise should be inside an transaction callback, because transaction could be resent
func (*PromiseValue) Scan ¶
func (p *PromiseValue) Scan(obj interface{}) error
Scan appened passed object with fetched fields
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query is interface for query building
func (*Query) Do ¶
func (q *Query) Do(tr *Transaction) *PromiseSlice
Do will return the primise for the query for current transaction
func (*Query) From ¶
From sets the part of primary key of item starting from which result will be returned primary key part passed to List param should be excluded
func (*Query) List ¶
List queries list of items using primary key subspace. Pass no params if fetching all objects
func (*Query) Next ¶
Next sets from identifier from nextFrom; return true if more data could be fetched
func (*Query) OnlyPrimary ¶
OnlyPrimary allow you to fetch just primary values of object, without retreaving everything else this mode allow you to fetch data much faster if you do not need all additional fields of object in the list
func (*Query) Promise ¶
func (q *Query) Promise() *PromiseSlice
Promise will return the primise for the query
func (*Query) SetReverse ¶
SetReverse set reverse value from param
func (*Query) To ¶
To sets the part of primary key which returning list should be ended primary key part passed to List param should be excluded
func (*Query) TryAll ¶
func (q *Query) TryAll(tr *Transaction, slicePointer interface{})
TryAll scans the query result within the transaction
type Relation ¶
type Relation struct {
// contains filtered or unexported fields
}
Relation is main struct to represent Relation
func (*Relation) Add ¶
func (r *Relation) Add(hostOrID interface{}, clientOrID interface{}) *PromiseErr
Add writes new relation beween objects (return ErrAlreadyExist if exists)
func (*Relation) ClientData ¶
ClientData will set cliet data field name
func (*Relation) CounterClient ¶
func (r *Relation) CounterClient(object *ObjectBuilder, fieldName string)
CounterClient will set external field
func (*Relation) Delete ¶
func (r *Relation) Delete(hostOrID interface{}, clientOrID interface{}) *PromiseErr
Delete removes relation between objects
func (*Relation) FillClientData ¶
func (r *Relation) FillClientData(hostOrID interface{}, client interface{}) *PromiseErr
FillClientData fetch client data, so it will be written into the data field of client object
func (*Relation) FillHostData ¶
func (r *Relation) FillHostData(host interface{}, clientOrID interface{}) *PromiseErr
FillHostData fetch client data and fill it to host object
func (*Relation) GetClientData ¶
func (r *Relation) GetClientData(hostOrID interface{}, clientOrID interface{}) *PromiseValue
GetClientData fetch client data
func (*Relation) GetClientDataIDs ¶
GetClientDataIDs returns client data bytes
func (*Relation) GetClientIDs ¶
GetClientIDs will fetch only primary values of client objects
func (*Relation) GetClients ¶
func (r *Relation) GetClients(objOrID interface{}, from interface{}) *PromiseSlice
GetClients fetch slice of client objects using host
func (*Relation) GetClientsCount ¶
GetClientsCount fetches counter
func (*Relation) GetHostData ¶
func (r *Relation) GetHostData(hostOrID interface{}, clientOrID interface{}) *PromiseValue
GetHostData fetch client data
func (*Relation) GetHostIDs ¶
GetHostIDs will fetch only primary values of host objects
func (*Relation) GetHosts ¶
func (r *Relation) GetHosts(objOrID interface{}, from interface{}) *PromiseSlice
GetHosts fetch slice of client objects using host
func (*Relation) GetHostsCount ¶
GetHostsCount fetches counter
func (*Relation) Set ¶
func (r *Relation) Set(hostOrID interface{}, clientOrID interface{}) *PromiseErr
Set writes new relation beween objects, you could use objects or values with same types as primary key
func (*Relation) SetClientData ¶
SetClientData writed new data from host object (host data could be )
func (*Relation) SetData ¶
SetData writed new data for both host and client index storages, return fail if object nor exist
func (*Relation) SetHostData ¶
SetHostData writed new data from host object (host data could be )
func (*Relation) SetHostsCounterUnsafe ¶
SetHostsCounterUnsafe set hosts counter unsafely. User with care
func (*Relation) UpdateClientData ¶
func (r *Relation) UpdateClientData(hostObj interface{}, clientObj interface{}, callback func()) *Promise
UpdateClientData will atomicly update only client index storage data using callback
func (*Relation) UpdateData ¶
UpdateData will atomicly update host and client index storage data using callback
func (*Relation) UpdateHostData ¶
func (r *Relation) UpdateHostData(hostObj interface{}, clientObj interface{}, callback func()) *Promise
UpdateHostData will atomicly update only host index storage data using callback
type Slice ¶
type Slice struct {
// contains filtered or unexported fields
}
Slice used for iteration over list of values
type SliceIDs ¶
type SliceIDs struct {
// contains filtered or unexported fields
}
SliceIDs is slice that contain only int64 data
type Struct ¶
type Struct struct {
// contains filtered or unexported fields
}
Struct used for work with input structure
type Tag ¶
type Tag struct { Name string Primary bool AutoIncrement bool UnStored bool // means this field doesn't stored inside main object data // contains filtered or unexported fields }
Tag is general object for tag parsing
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction allow you to join several Promises into one transaction also parallel executes promises effectively trying to parallel where its possible
func (*Transaction) Err ¶
func (t *Transaction) Err() error
Err will perform all promises and return err if any of them failed
func (*Transaction) Fail ¶
func (t *Transaction) Fail(err error)
Fail will set the transaction error, so
Source Files ¶
- benchmark.go
- cluster.go
- constants.go
- counter.go
- directory.go
- field.go
- index.go
- index_geo.go
- index_search.go
- multi.go
- needed.go
- object.go
- object_builder.go
- promise.go
- promise_err.go
- promise_slice.go
- promise_value.go
- query.go
- relation.go
- scheme.go
- search.go
- slice.go
- sliceIDs.go
- struct.go
- tests.go
- tests_new.go
- transaction.go
- util.go
- value.go