Documentation ¶
Index ¶
- type AQL
- type CollectionInfo
- type CollectionInfoList
- type CreateCollection
- type CreateDatabase
- type CreateGraph
- type CreateHashIndex
- type DropCollection
- type DropDatabase
- type DropGraph
- type EdgeDefinition
- type FollowCursor
- type GetCacheProperties
- type GetCollectionInfo
- type GetGraph
- type Graph
- type GraphData
- type GraphList
- type ImportCollection
- type JWTAuth
- type ListCollections
- type ListGraphs
- type SetCacheProperties
- type Transaction
- func (t *Transaction) AddAQL(resultVar, query string, params ...interface{}) *Transaction
- func (t *Transaction) Bind(name string, value interface{}) *Transaction
- func (t *Transaction) Generate() []byte
- func (t *Transaction) Method() string
- func (t *Transaction) Path() string
- func (t *Transaction) Return(resultVar string) *Transaction
- type TruncateCollection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AQL ¶
type AQL struct {
// contains filtered or unexported fields
}
AQL represents an AQL query.
func (*AQL) Bind ¶
Bind sets the name and value of a bind parameter Binding parameters prevents AQL injection
type CollectionInfo ¶
type CollectionInfoList ¶
type CollectionInfoList struct { Collections []CollectionInfo `json:"collections"` Error bool `json:"error"` Code int `json:"code"` }
type CreateCollection ¶
type CreateCollection struct { JournalSize int `json:"journalSize,omitempty"` KeyOptions map[string]interface{} `json:"keyOptions,omitempty"` Name string `json:"name"` WaitForSync bool `json:"waitForSync,omitempty"` DoCompact bool `json:"doCompact,omitempty"` IsVolatile bool `json:"isVolatile,omitempty"` ShardKeys []string `json:"shardKeys,omitempty"` NumberOfShards int `json:"numberOfShards,omitempty"` IsSystem bool `json:"isSystem,omitempty"` Type int `json:"type,omitempty"` IndexBuckets int `json:"indexBuckets,omitempty"` }
CreateCollection creates a collection in database.
func (*CreateCollection) Generate ¶
func (r *CreateCollection) Generate() []byte
func (*CreateCollection) Method ¶
func (r *CreateCollection) Method() string
func (*CreateCollection) Path ¶
func (r *CreateCollection) Path() string
type CreateDatabase ¶
type CreateDatabase struct { Username string `json:"username,omitempty"` Name string `json:"name"` Extra json.RawMessage `json:"extra,omitempty"` Passwd string `json:"passwd,omitempty"` Active bool `json:"active,omitempty"` Users []map[string]interface{} `json:"users,omitempty"` }
CreateDatabase creates a new database.
func (*CreateDatabase) Generate ¶
func (r *CreateDatabase) Generate() []byte
func (*CreateDatabase) Method ¶
func (r *CreateDatabase) Method() string
func (*CreateDatabase) Path ¶
func (r *CreateDatabase) Path() string
type CreateGraph ¶
type CreateGraph struct { Name string `json:"name"` EdgeDefinitions []EdgeDefinition `json:"edgeDefinitions,omitempty"` OrphanCollections []string `json:"orphanCollections,omitempty"` }
CreateGraph creates a collection in database.
func (*CreateGraph) Generate ¶
func (c *CreateGraph) Generate() []byte
func (*CreateGraph) Method ¶
func (c *CreateGraph) Method() string
func (*CreateGraph) Path ¶
func (c *CreateGraph) Path() string
type CreateHashIndex ¶
type CreateHashIndex struct { CollectionName string `json:"-"` Fields []string `json:"fields,omitempty"` Unique bool `json:"unique,omitempty"` Type string `json:"type,omitempty"` Sparse bool `json:"sparse,omitempty"` }
CreateHashIndex creates a hash index in database.
func (*CreateHashIndex) Generate ¶
func (r *CreateHashIndex) Generate() []byte
func (*CreateHashIndex) Method ¶
func (r *CreateHashIndex) Method() string
func (*CreateHashIndex) Path ¶
func (r *CreateHashIndex) Path() string
type DropCollection ¶
type DropCollection struct {
Name string
}
DropCollection deletes a collection in database.
func (*DropCollection) Generate ¶
func (r *DropCollection) Generate() []byte
func (*DropCollection) Method ¶
func (r *DropCollection) Method() string
func (*DropCollection) Path ¶
func (r *DropCollection) Path() string
type DropDatabase ¶
type DropDatabase struct {
Name string
}
DropDatabase deletes a database.
func (*DropDatabase) Generate ¶
func (r *DropDatabase) Generate() []byte
func (*DropDatabase) Method ¶
func (r *DropDatabase) Method() string
func (*DropDatabase) Path ¶
func (r *DropDatabase) Path() string
type EdgeDefinition ¶
type EdgeDefinition struct { Collection string `json:"collection"` From []string `json:"from"` To []string `json:"to"` }
EdgeDefinition is a definition of the graph edges
type FollowCursor ¶
type FollowCursor struct {
Cursor string
}
FollowCursor queries the next page of result for the given cursor.
func (*FollowCursor) Generate ¶
func (r *FollowCursor) Generate() []byte
func (*FollowCursor) Method ¶
func (r *FollowCursor) Method() string
func (*FollowCursor) Path ¶
func (r *FollowCursor) Path() string
type GetCacheProperties ¶
type GetCacheProperties struct{}
GetCacheProperties retrieves the current query cache properties.
func (*GetCacheProperties) Generate ¶
func (r *GetCacheProperties) Generate() []byte
func (*GetCacheProperties) Method ¶
func (r *GetCacheProperties) Method() string
func (*GetCacheProperties) Path ¶
func (r *GetCacheProperties) Path() string
type GetCollectionInfo ¶
CollectionInfo gets information about the collection
func (*GetCollectionInfo) Generate ¶
func (c *GetCollectionInfo) Generate() []byte
func (*GetCollectionInfo) Method ¶
func (c *GetCollectionInfo) Method() string
func (*GetCollectionInfo) Path ¶
func (c *GetCollectionInfo) Path() string
type Graph ¶
type Graph struct { Name string `json:"name"` //An array of definitions for the edges EdgeDefinitions []EdgeDefinition `json:"edgeDefinitions,omitempty"` //An array of additional vertex collections. OrphanCollections []string `json:"orphanCollections,omitempty"` ID string `json:"_id,omitempty"` Rev string `json:"_rev,omitempty"` }
Graph represents a graph definition.
type GraphData ¶
type GraphData struct {
Graph Graph `json:"graph"`
}
GraphData is a container for data returned by a GET GRAPH request
type GraphList ¶
type GraphList struct {
Graphs []Graph `json:"graphs"`
}
GraphList is a container for data returned by a LIST GRAPHS request
type ImportCollection ¶
ImportCollection imports data to a collection
func (*ImportCollection) Generate ¶
func (c *ImportCollection) Generate() []byte
func (*ImportCollection) Method ¶
func (c *ImportCollection) Method() string
func (*ImportCollection) Path ¶
func (c *ImportCollection) Path() string
type ListCollections ¶
type ListCollections struct {
// contains filtered or unexported fields
}
ListCollections lists all collections from the current DB
func (*ListCollections) Generate ¶
func (c *ListCollections) Generate() []byte
func (*ListCollections) Method ¶
func (c *ListCollections) Method() string
func (*ListCollections) Path ¶
func (c *ListCollections) Path() string
type ListGraphs ¶
type ListGraphs struct{}
ListGraph lists all graphs known by the graph module.
func (*ListGraphs) Generate ¶
func (l *ListGraphs) Generate() []byte
func (*ListGraphs) Method ¶
func (l *ListGraphs) Method() string
func (*ListGraphs) Path ¶
func (l *ListGraphs) Path() string
type SetCacheProperties ¶
type SetCacheProperties struct { Mode string `json:"mode,omitempty"` MaxResults int `json:"maxResults,omitempty"` }
SetCacheProperties sets the query cache properties.
func (*SetCacheProperties) Generate ¶
func (r *SetCacheProperties) Generate() []byte
func (*SetCacheProperties) Method ¶
func (r *SetCacheProperties) Method() string
func (*SetCacheProperties) Path ¶
func (r *SetCacheProperties) Path() string
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction represents an ArangoDB transaction.
func NewTransaction ¶
func NewTransaction(readCol, writeCol []string) *Transaction
NewTransaction returns a new Transaction object.
func (*Transaction) AddAQL ¶
func (t *Transaction) AddAQL(resultVar, query string, params ...interface{}) *Transaction
AddAQL adds a new AQL query to the transaction. The result will be set in a temp variable named after the value of "resultVar". To use it from elsewhere in the transaction, use the Go templating convention.
e.g. NewTransaction([]string{}, []string{}).
AddAQL("var1", "FOR d IN documents RETURN d"). AddAQL("var2", "FOR d IN {{.var1}} RETURN d._id").Run(db)
func (*Transaction) Bind ¶
func (t *Transaction) Bind(name string, value interface{}) *Transaction
Bind sets the name and value of a bind parameter Binding parameters prevents AQL injection Example: transaction := NewTransaction([]string{}, []string{}).
AddAQL("var1", "FOR d IN nodes FILTER d._key == @key RETURN d._id"). AddAQL("var2", "FOR n IN nodes FILTER n._id == {{.var1}}[0] RETURN n._key").Return("var2")
transaction.Bind("key", 123)
func (*Transaction) Generate ¶
func (t *Transaction) Generate() []byte
func (*Transaction) Method ¶
func (t *Transaction) Method() string
func (*Transaction) Path ¶
func (t *Transaction) Path() string
func (*Transaction) Return ¶
func (t *Transaction) Return(resultVar string) *Transaction
Return sets the final "resultVar" that is returned at the end of the transaction.
type TruncateCollection ¶
type TruncateCollection struct {
Name string
}
TruncateCollection deletes a collection in database.
func (*TruncateCollection) Generate ¶
func (r *TruncateCollection) Generate() []byte
func (*TruncateCollection) Method ¶
func (r *TruncateCollection) Method() string
func (*TruncateCollection) Path ¶
func (r *TruncateCollection) Path() string