Documentation ¶
Index ¶
- Variables
- type Field
- type FieldBuilderType
- type Predicate
- type Relation
- type SelectBuilderType
- func (b SelectBuilderType) Bind(ps httprouter.Params) SelectBuilderType
- func (b SelectBuilderType) Build() *SelectStatement
- func (b SelectBuilderType) CounterVec(counter *prometheus.CounterVec) SelectBuilderType
- func (b SelectBuilderType) From(keyspace, table string) SelectBuilderType
- func (b SelectBuilderType) HistogramVec(histogram *prometheus.HistogramVec) SelectBuilderType
- func (b SelectBuilderType) Logger(logger *log.Logger) SelectBuilderType
- func (b SelectBuilderType) Select(fields ...Field) SelectBuilderType
- func (b SelectBuilderType) Session(session *gocql.Session) SelectBuilderType
- func (b SelectBuilderType) Where(column string, relation Relation, value interface{}) SelectBuilderType
- type SelectStatement
Constants ¶
This section is empty.
Variables ¶
var ( SelectBuilder = builder.Register(SelectBuilderType{}, SelectStatement{}).(SelectBuilderType) FieldBuilder = builder.Register(FieldBuilderType{}, Field{}).(FieldBuilderType) )
Functions ¶
This section is empty.
Types ¶
type FieldBuilderType ¶
FieldBuilderType is a fluent DSL for constructing Fields
func Column ¶
func Column(name string) FieldBuilderType
Column is convience function that returns a new Field builder with the supplied column name assigned.
func (FieldBuilderType) Alias ¶
func (b FieldBuilderType) Alias(label string) FieldBuilderType
Alias assigns an alias for the Field, and returns the builder.
func (FieldBuilderType) CastTo ¶
func (b FieldBuilderType) CastTo(kind string) FieldBuilderType
CastTo assigns the type to cast a Field value to, and returns the builder.
func (FieldBuilderType) Column ¶
func (b FieldBuilderType) Column(name string) FieldBuilderType
Column assigns the column name attribute of a Field, and returns the builder.
func (FieldBuilderType) Get ¶
func (b FieldBuilderType) Get() Field
Get constructs and returns a Field object
type SelectBuilderType ¶
SelectBuilderType is a fluent DSL for constructing SelectStatements
func (SelectBuilderType) Bind ¶
func (b SelectBuilderType) Bind(ps httprouter.Params) SelectBuilderType
Bind creates predicates with an EQ ('=') relation for each of the parameters in the supplied httprouter.Params.
func (SelectBuilderType) Build ¶
func (b SelectBuilderType) Build() *SelectStatement
Build constructs and returns a SelectStatement.
func (SelectBuilderType) CounterVec ¶
func (b SelectBuilderType) CounterVec(counter *prometheus.CounterVec) SelectBuilderType
CounterVec assigns a Prometheus CounterVec object to the statement under construction. The object supplied will be used to count HTTP requests proccessed by Handle().
func (SelectBuilderType) From ¶
func (b SelectBuilderType) From(keyspace, table string) SelectBuilderType
From assigns the keyspace and table name of the SELECT statement under construction.
func (SelectBuilderType) HistogramVec ¶
func (b SelectBuilderType) HistogramVec(histogram *prometheus.HistogramVec) SelectBuilderType
HistogramVec assigns a Prometheus HistogramVec object to the statement under construction. The object supplied will be used to create a latency histogram of HTTP requests processed by Handle().
func (SelectBuilderType) Logger ¶
func (b SelectBuilderType) Logger(logger *log.Logger) SelectBuilderType
Logger assigns a logger object to the statement under construction. The supplied object will be used to output logging information from HTTP requests processed by Handle().
func (SelectBuilderType) Select ¶
func (b SelectBuilderType) Select(fields ...Field) SelectBuilderType
Select adds zero or more fields to the projection of the SELECT statement being constructed. If no fields are added (or if Select() is never invoked), then the projection will contain '*'.
func (SelectBuilderType) Session ¶
func (b SelectBuilderType) Session(session *gocql.Session) SelectBuilderType
Session assigns a GoCQL Session object to the statement under construction. The Session supplied will be used to execute CQL queries against.
func (SelectBuilderType) Where ¶
func (b SelectBuilderType) Where(column string, relation Relation, value interface{}) SelectBuilderType
Where adds a predicate to the SELECT statement under construction.
type SelectStatement ¶
type SelectStatement struct { Keyspace string Table string Fields []Field Predicates []Predicate Session *gocql.Session CounterVec *prometheus.CounterVec HistogramVec *prometheus.HistogramVec Logger *log.Logger // contains filtered or unexported fields }
SelectStatement represents a CQL SELECT statement
func (*SelectStatement) Handle ¶
func (s *SelectStatement) Handle(w http.ResponseWriter, request *http.Request)
Handle processes an HTTP request, querying the database for results, and returning them as a JSON-formatted response.
func (*SelectStatement) String ¶
func (s *SelectStatement) String() string
String returns the CQL query string for a SelectStatement