Documentation
¶
Index ¶
- Variables
- func ErrJSON(HTTPStatus int, err error, args ...interface{}) error
- func ProcessRequest(req Request, reqFunc ReqFunction) (data iop.Dataset, err error)
- func StringRecords(data *iop.Dataset) []map[string]interface{}
- type ReqFunction
- type Request
- func (r *Request) CanRead(table database.Table) bool
- func (r *Request) CanWrite(table database.Table) bool
- func (req *Request) GetDatastream() (ds *iop.Datastream, err error)
- func (r *Request) GetFileUpload() (src io.ReadCloser, err error)
- func (r *Request) URL() *url.URL
- func (r *Request) Validate(checks ...requestCheck) (err error)
- type Response
- type Server
Constants ¶
This section is empty.
Variables ¶
View Source
var StandardRoutes = []echo.Route{
{
Name: "getStatus",
Method: "GET",
Path: "/.status",
Handler: getStatus,
},
{
Name: "getConnections",
Method: "GET",
Path: "/.connections",
Handler: getConnections,
},
{
Name: "getConnectionDatabases",
Method: "GET",
Path: "/:connection/.databases",
Handler: getConnectionDatabases,
},
{
Name: "getConnectionSchemas",
Method: "GET",
Path: "/:connection/.schemas",
Handler: getConnectionSchemas,
},
{
Name: "getConnectionTables",
Method: "GET",
Path: "/:connection/.tables",
Handler: getConnectionTables,
},
{
Name: "getConnectionColumns",
Method: "GET",
Path: "/:connection/.columns",
Handler: getConnectionColumns,
},
{
Name: "submitSQL",
Method: "POST",
Path: "/:connection/.sql",
Handler: postConnectionSQL,
},
{
Name: "submitSQL_ID",
Method: "POST",
Path: "/:connection/.sql/:id",
Handler: postConnectionSQL,
},
{
Name: "cancelSQL",
Method: "POST",
Path: "/:connection/.cancel/:id",
Handler: postConnectionCancel,
},
{
Name: "getSchemaTables",
Method: "GET",
Path: "/:connection/:schema/.tables",
Handler: getSchemaTables,
},
{
Name: "getSchemaColumns",
Method: "GET",
Path: "/:connection/:schema/.columns",
Handler: getSchemaColumns,
},
{
Name: "getTableColumns",
Method: "GET",
Path: "/:connection/:schema/:table/.columns",
Handler: getTableColumns,
},
{
Name: "getTableIndexes",
Method: "GET",
Path: "/:connection/:schema/:table/.indexes",
Handler: getTableIndexes,
},
{
Name: "getTableKeys",
Method: "GET",
Path: "/:connection/:schema/:table/.keys",
Handler: getTableKeys,
},
{
Name: "tableInsert",
Method: "POST",
Path: "/:connection/:schema/:table",
Handler: postTableInsert,
},
{
Name: "tableUpsert",
Method: "PUT",
Path: "/:connection/:schema/:table",
Handler: postTableUpsert,
},
{
Name: "tableUpdate",
Method: "PATCH",
Path: "/:connection/:schema/:table",
Handler: patchTableUpdate,
},
{
Name: "getTableSelect",
Method: "GET",
Path: "/:connection/:schema/:table",
Handler: getTableSelect,
},
}
Functions ¶
func ProcessRequest ¶
func ProcessRequest(req Request, reqFunc ReqFunction) (data iop.Dataset, err error)
ProcessRequest processes the request with the given function
func StringRecords ¶ added in v0.0.60
Records return rows of maps or string values
Types ¶
type ReqFunction ¶
ReqFunction is the request function type
type Request ¶
type Request struct { ID string `json:"id" query:"id"` // used for query ID Name string `json:"name" query:"name"` Connection string `json:"connection" query:"connection"` Database string `json:"database" query:"database"` Schema string `json:"schema" query:"schema"` Table string `json:"table" query:"table"` Query string `json:"query" query:"query"` Procedure string `json:"procedure" query:"procedure"` Data any `json:"data" query:"data"` Project *state.Project `json:"-" query:"-"` Header http.Header `json:"-" query:"-"` Roles state.RoleMap `json:"-" query:"-"` Permissions state.Permissions `json:"-" query:"-"` // contains filtered or unexported fields }
Request is the typical request struct
func NewRequest ¶
func NewRequest(c echo.Context) Request
func (*Request) GetDatastream ¶
func (req *Request) GetDatastream() (ds *iop.Datastream, err error)
func (*Request) GetFileUpload ¶
func (r *Request) GetFileUpload() (src io.ReadCloser, err error)
type Response ¶
type Response struct { Request Request `json:"-"` Error string `json:"error,omitempty"` Payload map[string]any `json:"-"` Status int `json:"-"` Header http.Header `json:"-" query:"-"` // contains filtered or unexported fields }
func NewResponse ¶
func (*Response) MakeStreaming ¶
Click to show internal directories.
Click to hide internal directories.