requests

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2017 License: MIT Imports: 5 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 AQLFunction

type AQLFunction struct {
	Name string `json:"name"`
	Code string `json:"code"`
}

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 CreateAQLFunction

type CreateAQLFunction struct {
	Name            string `json:"name"`
	Code            string `json:"code"`
	IsDeterministic bool   `json:"isDeterministic"`
}

CreateAQLFunction creates a new AQL user function.

func (*CreateAQLFunction) Generate

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

func (*CreateAQLFunction) Method

func (r *CreateAQLFunction) Method() string

func (*CreateAQLFunction) Path

func (r *CreateAQLFunction) Path() string

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 CurrentDatabase

type CurrentDatabase struct{}

CurrentDatabase retrieves information on the current database.

func (*CurrentDatabase) Generate

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

func (*CurrentDatabase) Method

func (r *CurrentDatabase) Method() string

func (*CurrentDatabase) Path

func (r *CurrentDatabase) Path() string

type DeleteAQLFunction

type DeleteAQLFunction struct {
	Name  string
	Group bool
}

DeleteAQLFunction removes an existing AQL user function.

func (*DeleteAQLFunction) Generate

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

func (*DeleteAQLFunction) Method

func (r *DeleteAQLFunction) Method() string

func (*DeleteAQLFunction) Path

func (r *DeleteAQLFunction) Path() string

type DistributionStatistic

type DistributionStatistic struct {
	Sum    float64 `json:"sum"`
	Count  int     `json:"count"`
	Counts []int   `json:"counts"`
}

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 GetAQLFunctions

type GetAQLFunctions struct {
	Namespace string
}

GetAQLFunctions gets all registered AQL functions.

func (*GetAQLFunctions) Generate

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

func (*GetAQLFunctions) Method

func (r *GetAQLFunctions) Method() string

func (*GetAQLFunctions) Path

func (r *GetAQLFunctions) Path() string

type GetAQLFunctionsResult

type GetAQLFunctionsResult []AQLFunction

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 GetStatistics

type GetStatistics struct{}

GetStatistics returns the statistics information.

func (*GetStatistics) Generate

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

func (*GetStatistics) Method

func (r *GetStatistics) Method() string

func (*GetStatistics) Path

func (r *GetStatistics) Path() string

type GetStatisticsDescription

type GetStatisticsDescription struct{}

GetStatisticsDescription fetches descriptive info of statistics.

func (*GetStatisticsDescription) Generate

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

func (*GetStatisticsDescription) Method

func (r *GetStatisticsDescription) Method() string

func (*GetStatisticsDescription) Path

func (r *GetStatisticsDescription) Path() string

type GetStatisticsDescriptionResult

type GetStatisticsDescriptionResult struct {
	Groups  []StatisticsGroup  `json:"groups"`
	Figures []StatisticsFigure `json:"figures"`
}

type GetStatisticsResult

type GetStatisticsResult struct {
	Time    float64
	Enabled bool
	// interface{} will be either float64 or DistributionStatistic.
	Statistics map[string]map[string]interface{}
}

func (*GetStatisticsResult) UnmarshalJSON

func (r *GetStatisticsResult) UnmarshalJSON(bytes []byte) (err error)

type GetVersion

type GetVersion struct {
	Details bool
}

GetVersion returns the server version number.

func (*GetVersion) Generate

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

func (*GetVersion) Method

func (r *GetVersion) Method() string

func (*GetVersion) Path

func (r *GetVersion) Path() string

type GetVersionResult

type GetVersionResult struct {
	Server  string            `json:"server"`
	Version string            `json:"version"`
	License string            `json:"license"`
	Details map[string]string `json:"details"`
}

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
	FromPrefix     string
	ToPrefix       string
	Overwrite      bool
	WaitForSync    bool
	OnDuplicate    string
	Complete       bool
	Details        bool
}

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 StatisticsFigure

type StatisticsFigure struct {
	Group       string               `json:"group"`
	Identifier  string               `json:"identifier"`
	Name        string               `json:"name"`
	Description string               `json:"description"`
	Type        StatisticsFigureType `json:"type"`
	Cuts        []float64            `json:"cuts,omitempty"`
	Units       string               `json:"units"`
}

type StatisticsFigureType

type StatisticsFigureType string
const (
	StatisticsFigureTypeCurrent      StatisticsFigureType = "current"
	StatisticsFigureTypeAccumulated  StatisticsFigureType = "accumulated"
	StatisticsFigureTypeDistribution StatisticsFigureType = "distribution"
)

type StatisticsGroup

type StatisticsGroup struct {
	Group       string `json:"group"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

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) LockTimeout

func (t *Transaction) LockTimeout(lockTimeout int) *Transaction

LockTimeout sets the optional lockTimeout value.

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.

func (*Transaction) WaitForSync

func (t *Transaction) WaitForSync(waitForSync bool) *Transaction

WaitForSync sets the optional waitForSync flag.

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