Documentation
¶
Overview ¶
Package query provides query building and parsing functionalities used by both MicroDB client and external users.
Package query provides query building and parsing functionalities used by both MicroDB client and external users.
Index ¶
- Constants
- type DestinationType
- type QueryStmt
- func (q *QueryStmt) GetDestinationTable() string
- func (q *QueryStmt) GetDestinationType() DestinationType
- func (q *QueryStmt) GetQueryType() QueryType
- func (q *QueryStmt) GetRequiredTables() []string
- func (q *QueryStmt) OnLocal() *QueryStmt
- func (q *QueryStmt) OnOrigin() *QueryStmt
- func (q *QueryStmt) SQL() string
- type QueryType
Constants ¶
const ( // QueryTypeSelect represents a SELECT statement. QueryTypeSelect = iota // QueryTypeInsert represents an INSERT or REPLACE statement. QueryTypeInsert // QueryTypeUpdate represents an UPDATE statement. QueryTypeUpdate // DestinationTypeLocal represents using local database as destination. DestinationTypeLocal // DestinationTypeOrigin represents using data origin as destination. DestinationTypeOrigin )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DestinationType ¶
type DestinationType int
DestinationType represents the type of destination for the query.
type QueryStmt ¶
type QueryStmt struct {
// contains filtered or unexported fields
}
QueryStmt represents a parsed query. nolint // Silence name suggestion.
func Query ¶
Query creates a new query statement.
This is used for chaining to provide access to MicroDB specific API through a conventitional builder interface.
func (*QueryStmt) GetDestinationTable ¶
GetDestinationTable returns the destination table.
This is only used for INSERT queries.
func (*QueryStmt) GetDestinationType ¶
func (q *QueryStmt) GetDestinationType() DestinationType
GetDestinationType returns the destination.
func (*QueryStmt) GetQueryType ¶
GetQueryType returns the query type.
func (*QueryStmt) GetRequiredTables ¶
GetRequiredTables returns all the tables required by the query.
func (*QueryStmt) OnLocal ¶
OnLocal forces the query to the local database.
This could be overrided at query-time if the query contains tables that do not exist locally.