Documentation ¶
Index ¶
- Constants
- func HandleSQL(stmt string)
- func HandleStatus()
- func ValidateSql(val string) (int, error)
- type App
- func (app *App) BeginBlock(req abci.RequestBeginBlock) abci.ResponseBeginBlock
- func (app *App) CheckTx(tx []byte) abci.ResponseCheckTx
- func (app *App) Commit() abci.ResponseCommit
- func (app *App) DeliverTx(tx []byte) abci.ResponseDeliverTx
- func (app *App) EndBlock(req abci.RequestEndBlock) abci.ResponseEndBlock
- func (app *App) Info(req abci.RequestInfo) abci.ResponseInfo
- func (app *App) InitChain(req abci.RequestInitChain) abci.ResponseInitChain
- func (app *App) Query(reqQuery abci.RequestQuery) abci.ResponseQuery
- type DbWrapper
- type QueryResult
- type QueryService
- type Statement
- type StatementRequest
Constants ¶
View Source
const ( STATE_URL = "http://localhost:3000" QUERY_URL = "http://localhost:3000/query" OTHER_URL = "http://localhost:3000/stmt" )
View Source
const ( SELECT = 0 DROP = 1 OTHER = 2 BAD = 3 )
View Source
const PORT = ":3000"
Routes /query -> takes a query and returns result /stmt -> does the same / -> returns the lastes state PORT http addr
Variables ¶
This section is empty.
Functions ¶
func HandleStatus ¶
func HandleStatus()
func ValidateSql ¶
ValidateSql checks the incoming statements for correctness. 'drop' statements are not allowed
Types ¶
type App ¶
type App struct { abci.BaseApplication // contains filtered or unexported fields }
func (*App) BeginBlock ¶
func (app *App) BeginBlock(req abci.RequestBeginBlock) abci.ResponseBeginBlock
BeginBlock called on new block
func (*App) CheckTx ¶
func (app *App) CheckTx(tx []byte) abci.ResponseCheckTx
CheckTx validate incoming txs
func (*App) DeliverTx ¶
func (app *App) DeliverTx(tx []byte) abci.ResponseDeliverTx
DeliverTx process txs
func (*App) EndBlock ¶
func (app *App) EndBlock(req abci.RequestEndBlock) abci.ResponseEndBlock
EndBlock called at end...
func (*App) InitChain ¶
func (app *App) InitChain(req abci.RequestInitChain) abci.ResponseInitChain
InitChain called on startup
type QueryResult ¶
type QueryResult struct { Columns []string `json:"columns,omitempty"` Values [][]interface{} `json:"values,omitempty"` }
type QueryService ¶
type QueryService struct {
// contains filtered or unexported fields
}
QueryService base struct for QueryServer
func NewQueryServer ¶
func NewQueryServer(db *DbWrapper) *QueryService
NewQueryServer create an http server that responds to SELECT statements
func (*QueryService) LatestState ¶
func (service *QueryService) LatestState(w http.ResponseWriter, r *http.Request)
func (*QueryService) QueryHandler ¶
func (service *QueryService) QueryHandler(w http.ResponseWriter, r *http.Request)
func (*QueryService) Run ¶
func (service *QueryService) Run() *http.Server
func (*QueryService) StatementHandler ¶
func (service *QueryService) StatementHandler(w http.ResponseWriter, r *http.Request)
type StatementRequest ¶
type StatementRequest []string
Click to show internal directories.
Click to hide internal directories.