Documentation ¶
Index ¶
- Variables
- func Debug()
- type Admin
- type Easy
- type Simple
- func (Simple) Get(txn *ndgo.Txn, predicate, value string, result interface{}) (err error)
- func (Simple) GetByID(txn *ndgo.Txn, uid string, result interface{}) (err error)
- func (Simple) GetOne(txn *ndgo.Txn, predicate, value string, result interface{}) (err error)
- func (Simple) New(txn *ndgo.Txn, obj interface{}) (err error)
- func (Simple) Upd(txn *ndgo.Txn, obj interface{}) (err error)
- type Stateless
- func (Stateless) Get(txn *ndgo.Txn, predicate, value, dgTypes string, result interface{}) (err error)
- func (Stateless) GetByID(txn *ndgo.Txn, uid, dgTypes string, result interface{}) (err error)
- func (Stateless) GetOne(txn *ndgo.Txn, predicate, value, dgTypes string, result interface{}) (err error)
- func (Stateless) New(txn *ndgo.Txn, obj interface{}) (uidMap map[string]string, err error)
- func (Stateless) Upd(txn *ndgo.Txn, uid, dgTypes string, obj interface{}) (err error)
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotExist = fmt.Errorf("object of requested type and uid does not exist")
)
Common Errors
var ( // ErrUpsertUID happens when running upsert with wrong uid set in struct. Methods: Upd ErrUpsertUID = fmt.Errorf("uid of object must be set to uid(U)") )
Stateless API Errors. Don't need to be handled in higher level APIs
var (
ErrWrongInput = fmt.Errorf("input needs to be *ptr")
)
User Errors
Functions ¶
Types ¶
type Admin ¶
type Admin struct{}
Admin groups helpers with non common administrative uses, to keep API clean Usage: ndgom.Admin{}.
type Easy ¶
type Easy struct{}
Easy groups Easy{}.API methods, the easiest one to use. Usage: ndgom.Easy{}. ...
func (Easy) Get ¶
Get makes db query and populates result with found value or values. If result is struct, returns first result. If is slice, returns all found results.
func (Easy) Init ¶
Init initializes dgraph instance with a maximum txn timeout. If timeout is 0, default value of 60 seconds will be used.
type Simple ¶
type Simple struct{}
Simple groups Simple{}.API methods. Usage: ndgom.Simple{}. ...
type Stateless ¶
type Stateless struct{}
Stateless groups stateless lower abstraction helpers. Does not use magic like reflection. Each helper does one db operation. Usage: ndgom.Stateless{}.
func (Stateless) Get ¶
func (Stateless) Get(txn *ndgo.Txn, predicate, value, dgTypes string, result interface{}) (err error)
Get makes db query and unmarshals results as array
func (Stateless) GetOne ¶
func (Stateless) GetOne(txn *ndgo.Txn, predicate, value, dgTypes string, result interface{}) (err error)
GetOne makes db query and unmarshals first result as object