click package - github.com/keuin/click - Go Packages
- type Array
- type BinaryExpression
- type Column
- type Expression
- func Alias(s string) Expression
- func And(sub ...Expression) Expression
- func Avg(v Expression) Expression
- func Concatenate(op Operator, sub ...Expression) Expression
- func Count(v ...Expression) Expression
- func CountIf(v Expression) Expression
- func Equal(l Expression, r Expression) Expression
- func Fn(name string, args ...Expression) Expression
- func GreaterOrEqualThan(l Expression, r Expression) Expression
- func GreaterThan(l Expression, r Expression) Expression
- func If(cond, v1, v2 Expression) Expression
- func In(v Expression, ary Tuple) Expression
- func IsNotNull(v Expression) Expression
- func LessOrEqualThan(l Expression, r Expression) Expression
- func LessThan(l Expression, r Expression) Expression
- func LiteralExpression[T any](v T) Expression
- func LiteralExpressionQuoted[T any](v T) Expression
- func LiteralExpressions[T any](v []T, quoteString bool) (ret []Expression)
- func NotEqual(l Expression, r Expression) Expression
- func NotIn(v Expression, ary Tuple) Expression
- func Or(sub ...Expression) Expression
- func Sum(v Expression) Expression
- type Format
- type FromExpression
- type LiteralOperand
- type Operator
- type OrderByExpression
- type OrderDirection
- type RenderStyle
- type SelectBuilder
- func (s *SelectBuilder) Build() (SelectQuery, error)
- func (s *SelectBuilder) BuildString() (string, error)
- func (s *SelectBuilder) Format(f Format) *SelectBuilder
- func (s *SelectBuilder) From(table FromExpression) *SelectBuilder
- func (s *SelectBuilder) FromExpression(style RenderStyle) (string, error)
- func (s *SelectBuilder) GroupBy(values ...Expression) *SelectBuilder
- func (s *SelectBuilder) Having(value Expression) *SelectBuilder
- func (s *SelectBuilder) Limit(n int) *SelectBuilder
- func (s *SelectBuilder) Offset(n int) *SelectBuilder
- func (s *SelectBuilder) OrderBy(values ...Expression) *SelectBuilder
- func (s *SelectBuilder) PrettyPrint(b ...bool) *SelectBuilder
- func (s *SelectBuilder) Sample(v float64) *SelectBuilder
- func (s *SelectBuilder) Select(values ...Expression) *SelectBuilder
- func (s *SelectBuilder) Where(where Expression) *SelectBuilder
- type SelectExpression
- type SelectOrderByExpression
- type SelectQuery
- type SimpleQuery
- type Table
- type Tuple
This section is empty.
This section is empty.
This section is empty.
type BinaryExpression struct {
Operator Operator
LeftOperand Expression
RightOperand Expression
}
type Expression interface {
Expression() string
}
Expression is a ClickHouse SQL expression AST object.
func And ¶
func And(sub ...Expression) Expression
func Avg(v Expression) Expression
func Concatenate(op Operator, sub ...Expression) Expression
func Count(v ...Expression) Expression
func CountIf(v Expression) Expression
func Equal(l Expression, r Expression) Expression
func GreaterOrEqualThan(l Expression, r Expression) Expression
func GreaterThan(l Expression, r Expression) Expression
func If(cond, v1, v2 Expression) Expression
func In(v Expression, ary Tuple) Expression
func IsNotNull(v Expression) Expression
func LessOrEqualThan(l Expression, r Expression) Expression
func LessThan(l Expression, r Expression) Expression
func LiteralExpression[T any](v T) Expression
LiteralExpression converts a Go value to a SQL string, formatting that value to string with fmt.Sprint.
func LiteralExpressionQuoted[T any](v T) Expression
LiteralExpressionQuoted creates literal expression, treating the argument as a string value, not a SQL expression
func LiteralExpressions[T any](v []T, quoteString bool) (ret []Expression)
func NotEqual(l Expression, r Expression) Expression
func NotIn(v Expression, ary Tuple) Expression
func Or(sub ...Expression) Expression
func Sum(v Expression) Expression
Format is ClickHouse input/output format. The value is its string ID. User can construct custom formats by converting string to type Format. See https://clickhouse.com/docs/interfaces/formats
const ( FormatTabSeparated Format = "TabSeparated" FormatTabSeparatedRaw Format = "TabSeparatedRaw" FormatTabSeparatedWithNames Format = "TabSeparatedWithNames" FormatTabSeparatedWithNamesAndTypes Format = "TabSeparatedWithNamesAndTypes" FormatTabSeparatedRawWithNames Format = "TabSeparatedRawWithNames" FormatTabSeparatedRawWithNamesAndTypes Format = "TabSeparatedRawWithNamesAndTypes" FormatTemplate Format = "Template" FormatCSV Format = "CSV" FormatCSVWithNames Format = "CSVWithNames" FormatCSVWithNamesAndTypes Format = "CSVWithNamesAndTypes" FormatCustomSeparated Format = "CustomSeparated" FormatCustomSeparatedWithNames Format = "CustomSeparatedWithNames" FormatCustomSeparatedWithNamesAndTypes Format = "CustomSeparatedWithNamesAndTypes" FormatSQLInsert Format = "SQLInsert" FormatValues Format = "Values" FormatVertical Format = "Vertical" FormatJSON Format = "JSON" FormatJSONStrings Format = "JSONStrings" FormatJSONColumns Format = "JSONColumns" FormatJSONColumnsWithMetadata Format = "JSONColumnsWithMetadata" FormatJSONCompact Format = "JSONCompact" FormatJSONCompactStrings Format = "JSONCompactStrings" FormatJSONCompactColumns Format = "JSONCompactColumns" FormatJSONEachRow Format = "JSONEachRow" FormatPrettyJSONEachRow Format = "PrettyJSONEachRow" FormatJSONEachRowWithProgress Format = "JSONEachRowWithProgress" FormatJSONStringsEachRow Format = "JSONStringsEachRow" FormatJSONStringsEachRowWithProgress Format = "JSONStringsEachRowWithProgress" FormatJSONCompactEachRow Format = "JSONCompactEachRow" FormatJSONCompactEachRowWithNames Format = "JSONCompactEachRowWithNames" FormatJSONCompactEachRowWithNamesAndTypes Format = "JSONCompactEachRowWithNamesAndTypes" FormatJSONCompactEachRowWithProgress Format = "JSONCompactEachRowWithProgress" FormatJSONCompactStringsEachRow Format = "JSONCompactStringsEachRow" FormatJSONCompactStringsEachRowWithNames Format = "JSONCompactStringsEachRowWithNames" FormatJSONCompactStringsEachRowWithNamesAndTypes Format = "JSONCompactStringsEachRowWithNamesAndTypes" FormatJSONCompactStringsEachRowWithProgress Format = "JSONCompactStringsEachRowWithProgress" FormatJSONObjectEachRow Format = "JSONObjectEachRow" FormatBSONEachRow Format = "BSONEachRow" FormatTSKV Format = "TSKV" FormatPretty Format = "Pretty" FormatPrettyNoEscapes Format = "PrettyNoEscapes" FormatPrettyMonoBlock Format = "PrettyMonoBlock" FormatPrettyNoEscapesMonoBlock Format = "PrettyNoEscapesMonoBlock" FormatPrettyCompact Format = "PrettyCompact" FormatPrettyCompactNoEscapes Format = "PrettyCompactNoEscapes" FormatPrettyCompactMonoBlock Format = "PrettyCompactMonoBlock" FormatPrettyCompactNoEscapesMonoBlock Format = "PrettyCompactNoEscapesMonoBlock" FormatPrettySpace Format = "PrettySpace" FormatPrettySpaceNoEscapes Format = "PrettySpaceNoEscapes" FormatPrettySpaceMonoBlock Format = "PrettySpaceMonoBlock" FormatPrettySpaceNoEscapesMonoBlock Format = "PrettySpaceNoEscapesMonoBlock" FormatPrometheus Format = "Prometheus" FormatProtobuf Format = "Protobuf" FormatProtobufSingle Format = "ProtobufSingle" FormatProtobufList Format = "ProtobufList" FormatAvro Format = "Avro" FormatParquet Format = "Parquet" FormatArrow Format = "Arrow" FormatArrowStream Format = "ArrowStream" FormatORC Format = "ORC" FormatNpy Format = "Npy" FormatRowBinary Format = "RowBinary" FormatRowBinaryWithNames Format = "RowBinaryWithNames" FormatRowBinaryWithNamesAndTypes Format = "RowBinaryWithNamesAndTypes" FormatNative Format = "Native" FormatNull Format = "Null" FormatXML Format = "XML" FormatCapnProto Format = "CapnProto" FormatLineAsString Format = "LineAsString" FormatRawBLOB Format = "RawBLOB" FormatMsgPack Format = "MsgPack" FormatMarkdown Format = "Markdown" )
All output-able formats. Those cannot be used as output formats are not listed. See type Format for more info.
type FromExpression interface {
FromExpression(style RenderStyle) (string, error)
}
FromExpression is an Expression in FROM clause. Any Expression that can be used in nested query may implement FromExpression, customizing how it will look like when being selected from.
type OrderByExpression interface {
Expression
OrderByExpression() string
}
OrderByExpression is an Expression in ORDER BY clause. Any Expression that can be selected may implement OrderByExpression, customizing how it will look like when being ordered by.
func Desc(v Expression) OrderByExpression
const ( OrderDefault OrderDirection = iota OrderAscending OrderDescending )
type SelectBuilder struct {
}
SelectBuilder implements builder pattern for constructing SELECT SQLs. Its zero value is a ready-to-use empty builder. It's recommended to use Select as a shortcut.
func Select(values ...Expression) *SelectBuilder
func (s *SelectBuilder) Format(f Format) *SelectBuilder
func (s *SelectBuilder) From(table FromExpression) *SelectBuilder
func (s *SelectBuilder) GroupBy(values ...Expression) *SelectBuilder
func (s *SelectBuilder) Having(value Expression) *SelectBuilder
func (s *SelectBuilder) OrderBy(values ...Expression) *SelectBuilder
func (s *SelectBuilder) PrettyPrint(b ...bool) *SelectBuilder
func (s *SelectBuilder) Select(values ...Expression) *SelectBuilder
func (s *SelectBuilder) Where(where Expression) *SelectBuilder
type SelectExpression interface {
Expression
SelectExpression() string
}
SelectExpression is an expression in SELECT clause. Any Expression that can be selected may implement SelectExpression, customizing how it will look like when being selected.
type SelectOrderByExpression interface {
Expression
SelectExpression
OrderByExpression
}
type SelectQuery interface {
FromExpression
String() string
}