Documentation
¶
Index ¶
- type DeleteRecordsQueryParams
- type ErrorResponse
- type IndexDefinition
- type IndexDescription
- type IndexFieldDefinition
- type Key
- type ListRecordsQueryParams
- func (q ListRecordsQueryParams) SetCount(v int32) ListRecordsQueryParams
- func (q ListRecordsQueryParams) SetFields(v []string) ListRecordsQueryParams
- func (q ListRecordsQueryParams) SetFilters(v map[string]interface{}) ListRecordsQueryParams
- func (q ListRecordsQueryParams) SetOffset(v int32) ListRecordsQueryParams
- func (q ListRecordsQueryParams) SetOrderby(v []string) ListRecordsQueryParams
- type PingResponse
- type PingResponseStatus
- type QueryRecordsQueryParams
- func (q QueryRecordsQueryParams) SetCount(v int32) QueryRecordsQueryParams
- func (q QueryRecordsQueryParams) SetFields(v []string) QueryRecordsQueryParams
- func (q QueryRecordsQueryParams) SetOffset(v int32) QueryRecordsQueryParams
- func (q QueryRecordsQueryParams) SetOrderby(v []string) QueryRecordsQueryParams
- func (q QueryRecordsQueryParams) SetQuery(v string) QueryRecordsQueryParams
- type Service
- func (s *Service) CreateIndex(collection string, indexDefinition IndexDefinition, resp ...*http.Response) (*IndexDescription, error)
- func (s *Service) DeleteIndex(collection string, index string, resp ...*http.Response) error
- func (s *Service) DeleteRecordByKey(collection string, key string, resp ...*http.Response) error
- func (s *Service) DeleteRecords(collection string, query *DeleteRecordsQueryParams, resp ...*http.Response) error
- func (s *Service) GetRecordByKey(collection string, key string, resp ...*http.Response) (*map[string]interface{}, error)
- func (s *Service) InsertRecord(collection string, body map[string]interface{}, resp ...*http.Response) (*Key, error)
- func (s *Service) InsertRecords(collection string, requestBody []map[string]interface{}, ...) ([]string, error)
- func (s *Service) ListIndexes(collection string, resp ...*http.Response) ([]IndexDefinition, error)
- func (s *Service) ListRecords(collection string, query *ListRecordsQueryParams, resp ...*http.Response) ([]map[string]interface{}, error)
- func (s *Service) Ping(resp ...*http.Response) (*PingResponse, error)
- func (s *Service) PutRecord(collection string, key string, body map[string]interface{}, ...) (*Key, error)
- func (s *Service) QueryRecords(collection string, query *QueryRecordsQueryParams, resp ...*http.Response) ([]map[string]interface{}, error)
- type Servicer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeleteRecordsQueryParams ¶
type DeleteRecordsQueryParams struct {
// Query : Query JSON expression.
Query string `key:"query"`
}
DeleteRecordsQueryParams represents valid query parameters for the DeleteRecords operation For convenience DeleteRecordsQueryParams can be formed in a single statement, for example:
`v := DeleteRecordsQueryParams{}.SetQuery(...)`
func (DeleteRecordsQueryParams) SetQuery ¶
func (q DeleteRecordsQueryParams) SetQuery(v string) DeleteRecordsQueryParams
type ErrorResponse ¶
type IndexDefinition ¶
type IndexDefinition struct {
Fields []IndexFieldDefinition `json:"fields"`
// The name of the index.
Name string `json:"name"`
}
type IndexDescription ¶
type IndexDescription struct {
// The collection name.
Collection *string `json:"collection,omitempty"`
Fields []IndexFieldDefinition `json:"fields,omitempty"`
// The name of the index.
Name *string `json:"name,omitempty"`
}
type IndexFieldDefinition ¶
type ListRecordsQueryParams ¶
type ListRecordsQueryParams struct {
// Count : Maximum number of records to return.
Count *int32 `key:"count"`
// Fields : Comma-separated list of fields to include or exclude.
Fields []string `key:"fields"`
Filters map[string]interface{} `key:"filters"`
// Offset : Number of records to skip from the start.
Offset *int32 `key:"offset"`
// Orderby : Sort order. Format is `<field>:<sort order>`. Valid sort orders are 1 for ascending, -1 for descending.
Orderby []string `key:"orderby"`
}
ListRecordsQueryParams represents valid query parameters for the ListRecords operation For convenience ListRecordsQueryParams can be formed in a single statement, for example:
`v := ListRecordsQueryParams{}.SetCount(...).SetFields(...).SetFilters(...).SetOffset(...).SetOrderby(...)`
func (ListRecordsQueryParams) SetCount ¶
func (q ListRecordsQueryParams) SetCount(v int32) ListRecordsQueryParams
func (ListRecordsQueryParams) SetFields ¶
func (q ListRecordsQueryParams) SetFields(v []string) ListRecordsQueryParams
func (ListRecordsQueryParams) SetFilters ¶
func (q ListRecordsQueryParams) SetFilters(v map[string]interface{}) ListRecordsQueryParams
func (ListRecordsQueryParams) SetOffset ¶
func (q ListRecordsQueryParams) SetOffset(v int32) ListRecordsQueryParams
func (ListRecordsQueryParams) SetOrderby ¶
func (q ListRecordsQueryParams) SetOrderby(v []string) ListRecordsQueryParams
type PingResponse ¶
type PingResponse struct {
// Database status.
Status PingResponseStatus `json:"status"`
// If database is not healthy, detailed error message.
ErrorMessage *string `json:"errorMessage,omitempty"`
}
type PingResponseStatus ¶
type PingResponseStatus string
PingResponseStatus : Database status.
const ( PingResponseStatusHealthy PingResponseStatus = "healthy" PingResponseStatusUnhealthy PingResponseStatus = "unhealthy" PingResponseStatusUnknown PingResponseStatus = "unknown" )
List of PingResponseStatus
type QueryRecordsQueryParams ¶
type QueryRecordsQueryParams struct {
// Count : Maximum number of records to return.
Count *int32 `key:"count"`
// Fields : Comma-separated list of fields to include or exclude.
Fields []string `key:"fields"`
// Offset : Number of records to skip from the start.
Offset *int32 `key:"offset"`
// Orderby : Sort order. Format is `<field>:<sort order>`. Valid sort orders are 1 for ascending, -1 for descending.
Orderby []string `key:"orderby"`
// Query : Query JSON expression.
Query string `key:"query"`
}
QueryRecordsQueryParams represents valid query parameters for the QueryRecords operation For convenience QueryRecordsQueryParams can be formed in a single statement, for example:
`v := QueryRecordsQueryParams{}.SetCount(...).SetFields(...).SetOffset(...).SetOrderby(...).SetQuery(...)`
func (QueryRecordsQueryParams) SetCount ¶
func (q QueryRecordsQueryParams) SetCount(v int32) QueryRecordsQueryParams
func (QueryRecordsQueryParams) SetFields ¶
func (q QueryRecordsQueryParams) SetFields(v []string) QueryRecordsQueryParams
func (QueryRecordsQueryParams) SetOffset ¶
func (q QueryRecordsQueryParams) SetOffset(v int32) QueryRecordsQueryParams
func (QueryRecordsQueryParams) SetOrderby ¶
func (q QueryRecordsQueryParams) SetOrderby(v []string) QueryRecordsQueryParams
func (QueryRecordsQueryParams) SetQuery ¶
func (q QueryRecordsQueryParams) SetQuery(v string) QueryRecordsQueryParams
type Service ¶
type Service services.BaseService
func NewService ¶
NewService creates a new kvstore service client from the given Config
func (*Service) CreateIndex ¶
func (s *Service) CreateIndex(collection string, indexDefinition IndexDefinition, resp ...*http.Response) (*IndexDescription, error)
CreateIndex - Creates an index on a collection. Parameters:
collection: The name of the collection. indexDefinition resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
func (*Service) DeleteIndex ¶
DeleteIndex - Removes an index from a collection. Parameters:
collection: The name of the collection. index: The name of the index. resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
func (*Service) DeleteRecordByKey ¶
DeleteRecordByKey - Deletes a record with a given key. Parameters:
collection: The name of the collection. key: The key of the record. resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
func (*Service) DeleteRecords ¶
func (s *Service) DeleteRecords(collection string, query *DeleteRecordsQueryParams, resp ...*http.Response) error
DeleteRecords - Removes records in a collection that match the query. Parameters:
collection: The name of the collection. query: a struct pointer of valid query parameters for the endpoint, nil to send no query parameters resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
func (*Service) GetRecordByKey ¶
func (s *Service) GetRecordByKey(collection string, key string, resp ...*http.Response) (*map[string]interface{}, error)
GetRecordByKey - Returns a record with a given key. Parameters:
collection: The name of the collection. key: The key of the record. resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
func (*Service) InsertRecord ¶
func (s *Service) InsertRecord(collection string, body map[string]interface{}, resp ...*http.Response) (*Key, error)
InsertRecord - Inserts a record into a collection. Parameters:
collection: The name of the collection. body: Record to add to the collection, formatted as a JSON object. resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
func (*Service) InsertRecords ¶
func (s *Service) InsertRecords(collection string, requestBody []map[string]interface{}, resp ...*http.Response) ([]string, error)
InsertRecords - Inserts multiple records in a single request. Parameters:
collection: The name of the collection. requestBody: Array of records to insert. resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
func (*Service) ListIndexes ¶
ListIndexes - Returns a list of all indexes on a collection. Parameters:
collection: The name of the collection. resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
func (*Service) ListRecords ¶
func (s *Service) ListRecords(collection string, query *ListRecordsQueryParams, resp ...*http.Response) ([]map[string]interface{}, error)
ListRecords - Returns a list of records in a collection with basic filtering, sorting, pagination and field projection. Use key-value query parameters to filter fields. Fields are implicitly ANDed and values for the same field are implicitly ORed. Parameters:
collection: The name of the collection. query: a struct pointer of valid query parameters for the endpoint, nil to send no query parameters resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
func (*Service) Ping ¶
func (s *Service) Ping(resp ...*http.Response) (*PingResponse, error)
Ping - Returns the health status from the database. Parameters:
resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
func (*Service) PutRecord ¶
func (s *Service) PutRecord(collection string, key string, body map[string]interface{}, resp ...*http.Response) (*Key, error)
PutRecord - Updates the record with a given key, either by inserting or replacing the record. Parameters:
collection: The name of the collection. key: The key of the record. body: Record to add to the collection, formatted as a JSON object. resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
func (*Service) QueryRecords ¶
func (s *Service) QueryRecords(collection string, query *QueryRecordsQueryParams, resp ...*http.Response) ([]map[string]interface{}, error)
QueryRecords - Returns a list of query records in a collection. Parameters:
collection: The name of the collection. query: a struct pointer of valid query parameters for the endpoint, nil to send no query parameters resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
type Servicer ¶
type Servicer interface {
/*
CreateIndex - Creates an index on a collection.
Parameters:
collection: The name of the collection.
indexDefinition
resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
*/
CreateIndex(collection string, indexDefinition IndexDefinition, resp ...*http.Response) (*IndexDescription, error)
/*
DeleteIndex - Removes an index from a collection.
Parameters:
collection: The name of the collection.
index: The name of the index.
resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
*/
DeleteIndex(collection string, index string, resp ...*http.Response) error
/*
DeleteRecordByKey - Deletes a record with a given key.
Parameters:
collection: The name of the collection.
key: The key of the record.
resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
*/
DeleteRecordByKey(collection string, key string, resp ...*http.Response) error
/*
DeleteRecords - Removes records in a collection that match the query.
Parameters:
collection: The name of the collection.
query: a struct pointer of valid query parameters for the endpoint, nil to send no query parameters
resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
*/
DeleteRecords(collection string, query *DeleteRecordsQueryParams, resp ...*http.Response) error
/*
GetRecordByKey - Returns a record with a given key.
Parameters:
collection: The name of the collection.
key: The key of the record.
resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
*/
GetRecordByKey(collection string, key string, resp ...*http.Response) (*map[string]interface{}, error)
/*
InsertRecord - Inserts a record into a collection.
Parameters:
collection: The name of the collection.
body: Record to add to the collection, formatted as a JSON object.
resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
*/
InsertRecord(collection string, body map[string]interface{}, resp ...*http.Response) (*Key, error)
/*
InsertRecords - Inserts multiple records in a single request.
Parameters:
collection: The name of the collection.
requestBody: Array of records to insert.
resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
*/
InsertRecords(collection string, requestBody []map[string]interface{}, resp ...*http.Response) ([]string, error)
/*
ListIndexes - Returns a list of all indexes on a collection.
Parameters:
collection: The name of the collection.
resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
*/
ListIndexes(collection string, resp ...*http.Response) ([]IndexDefinition, error)
/*
ListRecords - Returns a list of records in a collection with basic filtering, sorting, pagination and field projection.
Use key-value query parameters to filter fields. Fields are implicitly ANDed and values for the same field are implicitly ORed.
Parameters:
collection: The name of the collection.
query: a struct pointer of valid query parameters for the endpoint, nil to send no query parameters
resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
*/
ListRecords(collection string, query *ListRecordsQueryParams, resp ...*http.Response) ([]map[string]interface{}, error)
/*
Ping - Returns the health status from the database.
Parameters:
resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
*/
Ping(resp ...*http.Response) (*PingResponse, error)
/*
PutRecord - Updates the record with a given key, either by inserting or replacing the record.
Parameters:
collection: The name of the collection.
key: The key of the record.
body: Record to add to the collection, formatted as a JSON object.
resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
*/
PutRecord(collection string, key string, body map[string]interface{}, resp ...*http.Response) (*Key, error)
/*
QueryRecords - Returns a list of query records in a collection.
Parameters:
collection: The name of the collection.
query: a struct pointer of valid query parameters for the endpoint, nil to send no query parameters
resp: an optional pointer to a http.Response to be populated by this method. NOTE: only the first resp pointer will be used if multiple are provided
*/
QueryRecords(collection string, query *QueryRecordsQueryParams, resp ...*http.Response) ([]map[string]interface{}, error)
}
Servicer represents the interface for implementing all endpoints for this service