handler

package
v0.0.0-...-dbd5d31 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package handler lists the commands for database service.

Index

Constants

View Source
const (
	NewCredentials command.Name = "new-credentials" // for pull controller, to receive credentials from vault
	SelectRow      command.Name = "select-row"      // Get one row, if it doesn't exist, return error
	SelectAll      command.Name = "select"          // Read multiple line
	INSERT         command.Name = "insert"          // insert new row
	UPDATE         command.Name = "update"          // update the existing row
	EXIST          command.Name = "exist"           // Returns true or false if select query has some rows
	DELETE         command.Name = "delete"          // Delete some rows from database
)

Variables

This section is empty.

Functions

func PullerEndpoint

func PullerEndpoint() string

PullerEndpoint returns the inproc pull controller to database.

The pull controller receives the message from database

func PushSocket

func PushSocket() (*zmq.Socket, error)

PushSocket creates a client socket to the database puller.

Used by the database credentials handler (for example: vault) to send to the database service new credentials.

Types

type DatabaseQueryRequest

type DatabaseQueryRequest struct {
	// Fields to manipulate,
	// for reading, it will have the SELECT clause fields
	//
	// for writing, it will have the INSERT VALUES() clause fields
	Fields    []string      `json:"fields,omitempty"`
	Tables    []string      `json:"tables"`              // Tables that are used for query
	Where     string        `json:"where,omitempty"`     // WHERE part of the SQL query
	Arguments []interface{} `json:"arguments,omitempty"` // to pass in where clause
}

DatabaseQueryRequest has the sql and it's parameters on part with commands.

func (DatabaseQueryRequest) BuildDeleteQuery

func (request DatabaseQueryRequest) BuildDeleteQuery() (string, error)

BuildDeleteQuery creates DELETE FROM SQL query

func (DatabaseQueryRequest) BuildExistQuery

func (request DatabaseQueryRequest) BuildExistQuery() (string, error)

func (DatabaseQueryRequest) BuildInsertRowQuery

func (request DatabaseQueryRequest) BuildInsertRowQuery() (string, error)

BuildInsertRowQuery creates an INSERT INTO SQL query

func (DatabaseQueryRequest) BuildSelectQuery

func (request DatabaseQueryRequest) BuildSelectQuery() (string, error)

BuildSelectQuery creates a SELECT SQL query

func (DatabaseQueryRequest) BuildSelectRowQuery

func (request DatabaseQueryRequest) BuildSelectRowQuery() (string, error)

BuildSelectRowQuery creates a SELECT SQL query for fetching one row

func (DatabaseQueryRequest) BuildUpdateQuery

func (request DatabaseQueryRequest) BuildUpdateQuery() (string, error)

BuildUpdateQuery creates an UPDATE SQL query

func (DatabaseQueryRequest) DeserializeBytes

func (request DatabaseQueryRequest) DeserializeBytes() error

DeserializeBytes the bytes array are accepted as base64 string with "==" tail. deserialize it into the sequence of the bytes.

If no arguments were given, or no need to serialize, then return nil

type DeleteReply

type DeleteReply struct{}

DeleteReply keeps the parameters of DELETE command reply by controller

type ExistReply

type ExistReply struct {
	Exist bool `json:"exist"` // true or false
}

ExistReply keeps the parameters of EXIST command reply by controller

type InsertReply

type InsertReply struct{}

InsertReply keeps the parameters of WRITE command reply by controller

type SelectAllReply

type SelectAllReply struct {
	Rows []key_value.KeyValue `json:"rows"` // list of rows returned back to user
}

SelectAllReply keeps the parameters of READ_ALL command reply by controller

type SelectRowReply

type SelectRowReply struct {
	Outputs key_value.KeyValue `json:"outputs"` // all column parameters returned back to user
}

SelectRowReply keeps the parameters of READ_ROW command reply by controller

type UpdateReply

type UpdateReply struct{}

UpdateReply keeps the parameters of UPDATE command reply by controller

Jump to

Keyboard shortcuts

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