requests

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

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 NewAQL

func NewAQL(query string, params ...interface{}) *AQL

NewAQL returns a new AQL object.

func (*AQL) BatchSize

func (a *AQL) BatchSize(size int) *AQL

BatchSize sets the batch size of the query

func (*AQL) Bind

func (a *AQL) Bind(name string, value interface{}) *AQL

Bind sets the name and value of a bind parameter Binding parameters prevents AQL injection

func (*AQL) Cache

func (a *AQL) Cache(enable bool) *AQL

Cache enables/disables the caching of the query. Unavailable prior to ArangoDB 2.7

func (*AQL) Generate

func (a *AQL) Generate() []byte

func (*AQL) Method

func (a *AQL) Method() string

func (*AQL) Path

func (a *AQL) Path() string

type CollectionInfo

type CollectionInfo struct {
	Id       string `json:"id"`
	Name     string `json:"name"`
	IsSystem bool   `json:"isSystem"`
	Status   int    `json:"status"`
	Type     int    `json:"type"`
}

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 DropGraph

type DropGraph struct {
	Name            string
	DropCollections bool
}

DropGraph deletes an existing graph.

func (*DropGraph) Generate

func (d *DropGraph) Generate() []byte

func (*DropGraph) Method

func (d *DropGraph) Method() string

func (*DropGraph) Path

func (d *DropGraph) 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

type GetCollectionInfo struct {
	CollectionName string
	IncludeSystem  bool
}

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 GetGraph

type GetGraph struct {
	Name string
}

GetGraph gets a graph from the graph module.

func (*GetGraph) Generate

func (g *GetGraph) Generate() []byte

func (*GetGraph) Method

func (g *GetGraph) Method() string

func (*GetGraph) Path

func (g *GetGraph) 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

type ImportCollection struct {
	CollectionName string
	Data           []byte
}

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 JWTAuth

type JWTAuth struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

JWTAuth authenticates the given user.

func (*JWTAuth) Generate

func (r *JWTAuth) Generate() []byte

func (*JWTAuth) Method

func (r *JWTAuth) Method() string

func (*JWTAuth) Path

func (r *JWTAuth) 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

Jump to

Keyboard shortcuts

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