Versions in this module Expand all Collapse all v0 v0.3.1 Jul 6, 2025 Changes in this version + const AllowCredentialsHeader + const AllowHeadersHeader + const AllowMethodsHeader + const AllowOriginHeader + const ServedByHTTPHeader + const VersionHTTPHeader + var ErrInvalidJSON = errors.New("invalid JSON body") + var ErrInvalidRequest = errors.New("invalid request") + var ErrLeaderNotFound = errors.New("leader not found") + var ErrNoStatements = errors.New("no statements") + var ErrUnsupportedType = errors.New("unsupported type") + func AnyServingHTTP(addrs []string) (string, bool) + func IsServingHTTP(addr string) bool + func ParseRequest(r io.Reader) ([]*command.Statement, error) + func ResetStats() + func SendResponse(w http.ResponseWriter, success bool, data interface{}, errorMsg string) + func SendResponseWithHeader(w http.ResponseWriter, success bool, data interface{}, errorMsg string, ...) + type Cluster interface + Execute func(er *command.ExecuteRequest, nodeAddr string, creds *clstrPB.Credentials, ...) ([]*command.ExecuteQueryResponse, error) + RemoveNode func(rn *command.RemoveNodeRequest, nodeAddr string, creds *clstrPB.Credentials, ...) error + Request func(eqr *command.ExecuteQueryRequest, nodeAddr string, creds *clstrPB.Credentials, ...) ([]*command.ExecuteQueryResponse, error) + Stats func() (map[string]interface{}, error) + type CreatePipelineModel struct + Sink map[string]interface{} + Source map[string]interface{} + type CredentialStore interface + AA func(username, password, perm string) bool + type DBResults struct + AssociativeJSON bool + BlobsAsArrays bool + ExecuteQueryResponse []*command.ExecuteQueryResponse + QueryRows []*command.QueryRows + func (d *DBResults) MarshalJSON() ([]byte, error) + type Database interface + GetFromDatabase func(key string) (string, error) + StoreInDatabase func(key, value string) error + type GetAddresser interface + GetNodeAPIAddr func(addr string, retries int, timeout time.Duration) (string, error) + type Node struct + APIAddr string + Addr string + Error string + ID string + Leader bool + Reachable bool + Time float64 + TimeS string + Voter bool + func NewNodeFromServer(s raft.Server) *Node + func (n *Node) MarshalJSON() ([]byte, error) + func (n *Node) SetError(err string) + func (n *Node) Test(ga GetAddresser, leaderAddr string, retries int, timeout time.Duration) + type Nodes []*Node + func NewNodesFromServers(servers []raft.Server) Nodes + func (n Nodes) GetNode(id string) *Node + func (n Nodes) HasAddr(addr string) bool + func (n Nodes) Len() int + func (n Nodes) Less(i, j int) bool + func (n Nodes) Swap(i, j int) + func (n Nodes) Test(ga GetAddresser, leaderAddr string, retries int, timeout time.Duration) + func (n Nodes) Voters() Nodes + type NodesRespDecoder struct + func NewNodesRespDecoder(r io.Reader) *NodesRespDecoder + func (d *NodesRespDecoder) Decode(nodes *Nodes) error + type NodesRespEncoder struct + func NewNodesRespEncoder(w io.Writer, legacy bool) *NodesRespEncoder + func (e *NodesRespEncoder) Encode(nodes Nodes) error + func (e *NodesRespEncoder) SetIndent(prefix, indent string) + type QueryParams map[string]string + func NewQueryParams(r *http.Request) (QueryParams, error) + func (qp QueryParams) Associative() bool + func (qp QueryParams) BackupFormat() command.BackupRequest_Format + func (qp QueryParams) BlobArray() bool + func (qp QueryParams) Bypass() bool + func (qp QueryParams) Compress() bool + func (qp QueryParams) DBTimeout(def time.Duration) time.Duration + func (qp QueryParams) Freshness() time.Duration + func (qp QueryParams) FreshnessStrict() bool + func (qp QueryParams) HasKey(k string) bool + func (qp QueryParams) Key() string + func (qp QueryParams) Level() command.QueryRequest_Level + func (qp QueryParams) NoLeader() bool + func (qp QueryParams) NoParse() bool + func (qp QueryParams) NoRewriteRandom() bool + func (qp QueryParams) NonVoters() bool + func (qp QueryParams) Pretty() bool + func (qp QueryParams) Query() string + func (qp QueryParams) Queue() bool + func (qp QueryParams) Redirect() bool + func (qp QueryParams) Retries(def int) int + func (qp QueryParams) Sync() bool + func (qp QueryParams) Timeout(def time.Duration) time.Duration + func (qp QueryParams) Timings() bool + func (qp QueryParams) TrailingLogs(def int) int + func (qp QueryParams) Tx() bool + func (qp QueryParams) Vacuum() bool + func (qp QueryParams) Version() string + func (qp QueryParams) Wait() bool + type Response struct + Error string + Results *DBResults + SequenceNum int64 + Time float64 + func NewResponse() *Response + func (r *Response) SetTime() + type ResponseModel struct + Data interface{} + Error string + Success bool + type Responser interface + SetTime func() + type ResultsError interface + Error func() string + IsAuthorized func() bool + type Service struct + BuildInfo map[string]interface{} + CACertFile string + CertFile string + ClientVerify bool + Context context.Context + DefaultQueueBatchSz int + DefaultQueueCap int + DefaultQueueTimeout time.Duration + DefaultQueueTx bool + KeyFile string + func New(addr string, store Store, cluster Cluster, credentials CredentialStore) *Service + func (s *Service) Addr() net.Addr + func (s *Service) AllowOrigin() string + func (s *Service) CheckRequestPerm(r *http.Request, perm string) (b bool) + func (s *Service) CheckRequestPermAll(r *http.Request, perms ...string) (b bool) + func (s *Service) Close() + func (s *Service) DoRedirect(w http.ResponseWriter, r *http.Request, qp QueryParams) bool + func (s *Service) FormRedirect(r *http.Request) (string, error) + func (s *Service) HTTPS() bool + func (s *Service) LeaderAPIAddr() string + func (s *Service) RegisterStatus(key string, stat StatusReporter) error + func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (s *Service) SetAllowOrigin(origin string) + func (s *Service) Start(ctx context.Context) error + type StatusReporter interface + Stats func() (map[string]interface{}, error) + type Store interface + Committed func(timeout time.Duration) (uint64, error) + LeaderAddr func() (string, error) + Nodes func() ([]raft.Server, error) + Ready func() bool + Remove func(rn *command.RemoveNodeRequest) error + Stats func() (map[string]interface{}, error)