Documentation
¶
Overview ¶
Copyright 2020 io.xream.sqlxb
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 io.xream.sqlxb ¶
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func ASC() string
- func ASOF() string
- func Bool(b bool) *bool
- func Byte(b byte) *byte
- func CROSS() string
- func DESC() string
- func Eq() string
- func FULL_OUTER() string
- func Float32(f float32) *float32
- func Float64(f float64) *float64
- func GLOBAL() string
- func Gt() string
- func Gte() string
- func INNER() string
- func Int(v int) *int
- func Int8(v int8) *int8
- func Int16(v int16) *int16
- func Int32(v int32) *int32
- func Int64(v int64) *int64
- func IsNull() string
- func LEFT() string
- func Like() string
- func LikeLeft() string
- func Lt() string
- func Lte() string
- func N2s(p interface{}) string
- func NON_JOIN() string
- func Ne() string
- func NilOrNumber(p interface{}) (bool, interface{})
- func NonNull() string
- func NotLike() string
- func Np2s(p interface{}) (string, bool)
- func RIGHT() string
- func Uint(v uint) *uint
- func Uint64(v uint64) *uint64
- type Bb
- type BoolFunc
- type BuilderX
- func (x *BuilderX) Agg(fn string, vs ...interface{}) *BuilderX
- func (x *BuilderX) And(sub func(cb *CondBuilder)) *BuilderX
- func (x *BuilderX) Any(any func(x *BuilderX)) *BuilderX
- func (x *BuilderX) As(alia string) *BuilderX
- func (x *BuilderX) Bool(preCond BoolFunc, then func(cb *CondBuilder)) *BuilderX
- func (x *BuilderX) Build() *Built
- func (x *BuilderX) Eq(k string, v interface{}) *BuilderX
- func (x *BuilderX) From(orFromSql string) *BuilderX
- func (x *BuilderX) FromX(fromX func(fb *FromBuilder)) *BuilderX
- func (x *BuilderX) GroupBy(groupBy string) *BuilderX
- func (x *BuilderX) Gt(k string, v interface{}) *BuilderX
- func (x *BuilderX) Gte(k string, v interface{}) *BuilderX
- func (x *BuilderX) Having(cond func(cb *CondBuilderX)) *BuilderX
- func (x *BuilderX) In(k string, vs ...interface{}) *BuilderX
- func (x *BuilderX) IsNull(key string) *BuilderX
- func (x *BuilderX) Last(last string) *BuilderX
- func (x *BuilderX) Like(k string, v string) *BuilderX
- func (x *BuilderX) LikeLeft(k string, v string) *BuilderX
- func (x *BuilderX) Lt(k string, v interface{}) *BuilderX
- func (x *BuilderX) Lte(k string, v interface{}) *BuilderX
- func (x *BuilderX) Ne(k string, v interface{}) *BuilderX
- func (x *BuilderX) Nin(k string, vs ...interface{}) *BuilderX
- func (x *BuilderX) NonNull(key string) *BuilderX
- func (x *BuilderX) NotLike(k string, v string) *BuilderX
- func (x *BuilderX) OR() *BuilderX
- func (x *BuilderX) Or(sub func(cb *CondBuilder)) *BuilderX
- func (x *BuilderX) Paged(page func(pb *PageBuilder)) *BuilderX
- func (x *BuilderX) Select(resultKeys ...string) *BuilderX
- func (x *BuilderX) Sort(orderBy string, direction Direction) *BuilderX
- func (x *BuilderX) Sub(s string, sub func(sb *BuilderX)) *BuilderX
- func (x *BuilderX) WithoutOptimization() *BuilderX
- func (x *BuilderX) X(k string, vs ...interface{}) *BuilderX
- type Built
- type CondBuilder
- func (cb *CondBuilder) And(sub func(cb *CondBuilder)) *CondBuilder
- func (cb *CondBuilder) Bool(preCond BoolFunc, then func(cb *CondBuilder)) *CondBuilder
- func (cb *CondBuilder) Eq(k string, v interface{}) *CondBuilder
- func (cb *CondBuilder) Gt(k string, v interface{}) *CondBuilder
- func (cb *CondBuilder) Gte(k string, v interface{}) *CondBuilder
- func (cb *CondBuilder) In(k string, vs ...interface{}) *CondBuilder
- func (cb *CondBuilder) IsNull(key string) *CondBuilder
- func (cb *CondBuilder) Like(k string, v string) *CondBuilder
- func (cb *CondBuilder) LikeLeft(k string, v string) *CondBuilder
- func (cb *CondBuilder) Lt(k string, v interface{}) *CondBuilder
- func (cb *CondBuilder) Lte(k string, v interface{}) *CondBuilder
- func (cb *CondBuilder) Ne(k string, v interface{}) *CondBuilder
- func (cb *CondBuilder) Nin(k string, vs ...interface{}) *CondBuilder
- func (cb *CondBuilder) NonNull(key string) *CondBuilder
- func (cb *CondBuilder) NotLike(k string, v string) *CondBuilder
- func (cb *CondBuilder) OR() *CondBuilder
- func (cb *CondBuilder) Or(sub func(cb *CondBuilder)) *CondBuilder
- func (cb *CondBuilder) X(k string, vs ...interface{}) *CondBuilder
- type CondBuilderX
- type Direction
- type FromBuilder
- func (fb *FromBuilder) As(alia string) *FromBuilder
- func (fb *FromBuilder) Cond(on func(on *ON)) *FromBuilder
- func (fb *FromBuilder) JOIN(join JOIN) *FromBuilder
- func (fb *FromBuilder) Of(tableName string) *FromBuilder
- func (fb *FromBuilder) On(onStr string) *FromBuilder
- func (fb *FromBuilder) Sub(sub func(sb *BuilderX)) *FromBuilder
- func (fb *FromBuilder) Using(key string) *FromBuilder
- type FromX
- type JOIN
- type Join
- type LongId
- type ON
- type Op
- type PageBuilder
- type PageCondition
- type Po
- type Qr
- type Sort
- type StringId
- type TotalRows
- type USING
Constants ¶
const ( XX = "" AGG = "" SUB = "SUB" AND = "AND" OR = "OR" AND_SUB = AND OR_SUB = OR EQ = "=" NE = "<>" GT = ">" LT = "<" GTE = ">=" LTE = "<=" LIKE = "LIKE" NOT_LIKE = "NOT LIKE" IN = "IN" NIN = "NOT IN" IS_NULL = "IS NULL" NON_NULL = "IS NOT NULL" )
Variables ¶
This section is empty.
Functions ¶
func FULL_OUTER ¶ added in v0.5.4
func FULL_OUTER() string
func NilOrNumber ¶
func NilOrNumber(p interface{}) (bool, interface{})
Types ¶
type BuilderX ¶
type BuilderX struct {
CondBuilderX
// contains filtered or unexported fields
}
To build sql, like: SELECT DISTINCT f.id FROM foo f INNER_JOIN JOIN (SELECT foo_id FROM bar) b ON b.foo_id = f.id Sql for MySQL, Clickhouse....
@author Sim
func (*BuilderX) And ¶ added in v0.5.5
func (x *BuilderX) And(sub func(cb *CondBuilder)) *BuilderX
func (*BuilderX) Bool ¶ added in v0.5.5
func (x *BuilderX) Bool(preCond BoolFunc, then func(cb *CondBuilder)) *BuilderX
func (*BuilderX) FromX ¶ added in v0.5.7
func (x *BuilderX) FromX(fromX func(fb *FromBuilder)) *BuilderX
func (*BuilderX) Having ¶
func (x *BuilderX) Having(cond func(cb *CondBuilderX)) *BuilderX
func (*BuilderX) Or ¶ added in v0.5.5
func (x *BuilderX) Or(sub func(cb *CondBuilder)) *BuilderX
func (*BuilderX) Paged ¶ added in v0.5.5
func (x *BuilderX) Paged(page func(pb *PageBuilder)) *BuilderX
func (*BuilderX) WithoutOptimization ¶
type Built ¶
type CondBuilder ¶ added in v0.5.1
type CondBuilder struct {
// contains filtered or unexported fields
}
func (*CondBuilder) And ¶ added in v0.5.1
func (cb *CondBuilder) And(sub func(cb *CondBuilder)) *CondBuilder
func (*CondBuilder) Bool ¶ added in v0.5.1
func (cb *CondBuilder) Bool(preCond BoolFunc, then func(cb *CondBuilder)) *CondBuilder
func (*CondBuilder) Eq ¶ added in v0.5.1
func (cb *CondBuilder) Eq(k string, v interface{}) *CondBuilder
func (*CondBuilder) Gt ¶ added in v0.5.1
func (cb *CondBuilder) Gt(k string, v interface{}) *CondBuilder
func (*CondBuilder) Gte ¶ added in v0.5.1
func (cb *CondBuilder) Gte(k string, v interface{}) *CondBuilder
func (*CondBuilder) In ¶ added in v0.5.1
func (cb *CondBuilder) In(k string, vs ...interface{}) *CondBuilder
func (*CondBuilder) IsNull ¶ added in v0.5.1
func (cb *CondBuilder) IsNull(key string) *CondBuilder
func (*CondBuilder) Like ¶ added in v0.5.1
func (cb *CondBuilder) Like(k string, v string) *CondBuilder
Like sql: LIKE %value%, Like() default has double %
func (*CondBuilder) LikeLeft ¶ added in v0.5.9
func (cb *CondBuilder) LikeLeft(k string, v string) *CondBuilder
LikeLeft sql: LIKE value%, Like() default has double %, then LikeLeft() remove left %
func (*CondBuilder) Lt ¶ added in v0.5.1
func (cb *CondBuilder) Lt(k string, v interface{}) *CondBuilder
func (*CondBuilder) Lte ¶ added in v0.5.1
func (cb *CondBuilder) Lte(k string, v interface{}) *CondBuilder
func (*CondBuilder) Ne ¶ added in v0.5.1
func (cb *CondBuilder) Ne(k string, v interface{}) *CondBuilder
func (*CondBuilder) Nin ¶ added in v0.5.1
func (cb *CondBuilder) Nin(k string, vs ...interface{}) *CondBuilder
func (*CondBuilder) NonNull ¶ added in v0.5.1
func (cb *CondBuilder) NonNull(key string) *CondBuilder
func (*CondBuilder) NotLike ¶ added in v0.5.1
func (cb *CondBuilder) NotLike(k string, v string) *CondBuilder
func (*CondBuilder) OR ¶ added in v0.5.1
func (cb *CondBuilder) OR() *CondBuilder
func (*CondBuilder) Or ¶ added in v0.5.1
func (cb *CondBuilder) Or(sub func(cb *CondBuilder)) *CondBuilder
func (*CondBuilder) X ¶ added in v0.5.1
func (cb *CondBuilder) X(k string, vs ...interface{}) *CondBuilder
type CondBuilderX ¶ added in v0.5.11
type CondBuilderX struct {
CondBuilder
}
func (*CondBuilderX) Sub ¶ added in v0.5.11
func (x *CondBuilderX) Sub(s string, sub func(sb *BuilderX)) *CondBuilderX
type FromBuilder ¶ added in v0.5.6
type FromBuilder struct {
// contains filtered or unexported fields
}
func (*FromBuilder) As ¶ added in v0.5.9
func (fb *FromBuilder) As(alia string) *FromBuilder
func (*FromBuilder) Cond ¶ added in v0.5.6
func (fb *FromBuilder) Cond(on func(on *ON)) *FromBuilder
func (*FromBuilder) JOIN ¶ added in v0.5.6
func (fb *FromBuilder) JOIN(join JOIN) *FromBuilder
func (*FromBuilder) Of ¶ added in v0.5.6
func (fb *FromBuilder) Of(tableName string) *FromBuilder
func (*FromBuilder) On ¶ added in v0.5.6
func (fb *FromBuilder) On(onStr string) *FromBuilder
func (*FromBuilder) Sub ¶ added in v0.5.6
func (fb *FromBuilder) Sub(sub func(sb *BuilderX)) *FromBuilder
func (*FromBuilder) Using ¶ added in v0.5.6
func (fb *FromBuilder) Using(key string) *FromBuilder
type ON ¶
type ON struct {
CondBuilder
// contains filtered or unexported fields
}
type PageBuilder ¶
type PageBuilder struct {
// contains filtered or unexported fields
}
func (*PageBuilder) IgnoreTotalRows ¶
func (pb *PageBuilder) IgnoreTotalRows() *PageBuilder
func (*PageBuilder) Last ¶
func (pb *PageBuilder) Last(last uint64) *PageBuilder
Last if ASC: orderBy > last else DESC: orderBy < last LIMIT rows
func (*PageBuilder) Page ¶
func (pb *PageBuilder) Page(page uint) *PageBuilder
func (*PageBuilder) Rows ¶
func (pb *PageBuilder) Rows(rows uint) *PageBuilder
func (*PageBuilder) SetTotalRowsIgnored ¶ added in v0.5.1
func (pb *PageBuilder) SetTotalRowsIgnored(ignored bool) *PageBuilder
type PageCondition ¶
type PageCondition struct {
// contains filtered or unexported fields
}