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 Bool(b bool) *bool
- func Byte(b byte) *byte
- func DESC() string
- func Eq() string
- func Float32(f float32) *float32
- func Float64(f float64) *float64
- func Gt() string
- func Gte() string
- func INNER_JOIN() 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_JOIN() string
- func Like() string
- func LikeRight() string
- func Lt() string
- func Lte() string
- func N2s(p interface{}) string
- func Ne() string
- func NilOrNumber(p interface{}) (bool, interface{})
- func NonJoin() string
- func NonNull() string
- func NotLike() string
- func Np2s(p interface{}) (string, bool)
- func RIGHT_JOIN() string
- func Uint(v uint) *uint
- func Uint64(v uint64) *uint64
- type Bb
- type BoolFunc
- type Builder
- type BuilderX
- func (x *BuilderX) Agg(fn string, vs ...interface{}) *BuilderX
- func (builder *BuilderX) Build() *Built
- func (x *BuilderX) GroupBy(groupBy string) *BuilderX
- func (x *BuilderX) Having(op Op, k string, v interface{}) *BuilderX
- func (x *BuilderX) ResultKey(resultKey string) *BuilderX
- func (x *BuilderX) ResultKeys(resultKeys ...string) *BuilderX
- func (x *BuilderX) Source(po Po) *BuilderX
- func (x *BuilderX) SourceScript(sqlScript string) *BuilderX
- func (x *BuilderX) SourceX(source func(sb *SourceBuilder)) *BuilderX
- func (builder *BuilderX) WithoutOptimization() *BuilderX
- type Built
- type CondBuilder
- func (builder *CondBuilder) And(sub func(sub *CondBuilder)) *CondBuilder
- func (builder *CondBuilder) Bool(preCond BoolFunc, then func(cb *CondBuilder)) *CondBuilder
- func (builder *CondBuilder) Eq(k string, v interface{}) *CondBuilder
- func (builder *CondBuilder) Gt(k string, v interface{}) *CondBuilder
- func (builder *CondBuilder) Gte(k string, v interface{}) *CondBuilder
- func (builder *CondBuilder) In(k string, vs ...interface{}) *CondBuilder
- func (builder *CondBuilder) IsNull(key string) *CondBuilder
- func (builder *CondBuilder) Like(k string, v string) *CondBuilder
- func (builder *CondBuilder) LikeRight(k string, v string) *CondBuilder
- func (builder *CondBuilder) Lt(k string, v interface{}) *CondBuilder
- func (builder *CondBuilder) Lte(k string, v interface{}) *CondBuilder
- func (builder *CondBuilder) Ne(k string, v interface{}) *CondBuilder
- func (builder *CondBuilder) Nin(k string, vs ...interface{}) *CondBuilder
- func (builder *CondBuilder) NonNull(key string) *CondBuilder
- func (builder *CondBuilder) NotLike(k string, v string) *CondBuilder
- func (builder *CondBuilder) OR() *CondBuilder
- func (builder *CondBuilder) Or(sub func(sub *CondBuilder)) *CondBuilder
- func (builder *CondBuilder) X(k string, vs ...interface{}) *CondBuilder
- type Direction
- type JOIN
- type Join
- type LongId
- type On
- type Op
- type PageBuilder
- type PageCondition
- type Po
- type Sort
- type SourceBuilder
- func (sb *SourceBuilder) Alia(alia string) *SourceBuilder
- func (sb *SourceBuilder) Cond(on func(on *On)) *SourceBuilder
- func (sb *SourceBuilder) Join(join JOIN) *SourceBuilder
- func (sb *SourceBuilder) ON(onStr string) *SourceBuilder
- func (sb *SourceBuilder) Source(po Po) *SourceBuilder
- func (sb *SourceBuilder) Sub(sub *BuilderX) *SourceBuilder
- func (sb *SourceBuilder) USING(key string) *SourceBuilder
- type SourceX
- type StringId
- type Using
Constants ¶
const ( X = "" AGG = "" 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 INNER_JOIN ¶
func INNER_JOIN() string
func NilOrNumber ¶
func NilOrNumber(p interface{}) (bool, interface{})
func RIGHT_JOIN ¶
func RIGHT_JOIN() string
Types ¶
type Builder ¶
type Builder struct {
CondBuilder
// contains filtered or unexported fields
}
TO build sql, like: SELECT * FROM .... Can add L2Cache
@author Sim
func NewBuilder ¶
func (*Builder) Paged ¶
func (builder *Builder) Paged(page func(pb *PageBuilder)) *Builder
type BuilderX ¶
type BuilderX struct {
Builder
// contains filtered or unexported fields
}
To build sql, like: SELECT DISTINCT f.id FROM foo f INNER JOIN (SELECT foo_id FROM bar) b ON b.foo_id = f.id Sql for MySQL, Clickhouse....
@author Sim
func NewBuilderX ¶
func NewBuilderX() *BuilderX
func (*BuilderX) ResultKeys ¶
func (*BuilderX) SourceScript ¶ added in v0.5.1
func (*BuilderX) SourceX ¶ added in v0.5.1
func (x *BuilderX) SourceX(source func(sb *SourceBuilder)) *BuilderX
func (*BuilderX) WithoutOptimization ¶
type Built ¶
type Built struct {
ResultKeys []string
ConditionX []Bb
Sorts []Sort
Havings []Bb
GroupBys []string
Aggs []Bb
OrSourceSql string
Sbs []*SourceX
Svs []interface{}
PageCondition *PageCondition
Po Po
}
func (*Built) SqlOfCondition ¶
type CondBuilder ¶ added in v0.5.1
type CondBuilder struct {
// contains filtered or unexported fields
}
func (*CondBuilder) And ¶ added in v0.5.1
func (builder *CondBuilder) And(sub func(sub *CondBuilder)) *CondBuilder
func (*CondBuilder) Bool ¶ added in v0.5.1
func (builder *CondBuilder) Bool(preCond BoolFunc, then func(cb *CondBuilder)) *CondBuilder
func (*CondBuilder) Eq ¶ added in v0.5.1
func (builder *CondBuilder) Eq(k string, v interface{}) *CondBuilder
func (*CondBuilder) Gt ¶ added in v0.5.1
func (builder *CondBuilder) Gt(k string, v interface{}) *CondBuilder
func (*CondBuilder) Gte ¶ added in v0.5.1
func (builder *CondBuilder) Gte(k string, v interface{}) *CondBuilder
func (*CondBuilder) In ¶ added in v0.5.1
func (builder *CondBuilder) In(k string, vs ...interface{}) *CondBuilder
func (*CondBuilder) IsNull ¶ added in v0.5.1
func (builder *CondBuilder) IsNull(key string) *CondBuilder
func (*CondBuilder) Like ¶ added in v0.5.1
func (builder *CondBuilder) Like(k string, v string) *CondBuilder
func (*CondBuilder) LikeRight ¶ added in v0.5.1
func (builder *CondBuilder) LikeRight(k string, v string) *CondBuilder
func (*CondBuilder) Lt ¶ added in v0.5.1
func (builder *CondBuilder) Lt(k string, v interface{}) *CondBuilder
func (*CondBuilder) Lte ¶ added in v0.5.1
func (builder *CondBuilder) Lte(k string, v interface{}) *CondBuilder
func (*CondBuilder) Ne ¶ added in v0.5.1
func (builder *CondBuilder) Ne(k string, v interface{}) *CondBuilder
func (*CondBuilder) Nin ¶ added in v0.5.1
func (builder *CondBuilder) Nin(k string, vs ...interface{}) *CondBuilder
func (*CondBuilder) NonNull ¶ added in v0.5.1
func (builder *CondBuilder) NonNull(key string) *CondBuilder
func (*CondBuilder) NotLike ¶ added in v0.5.1
func (builder *CondBuilder) NotLike(k string, v string) *CondBuilder
func (*CondBuilder) OR ¶ added in v0.5.1
func (builder *CondBuilder) OR() *CondBuilder
func (*CondBuilder) Or ¶ added in v0.5.1
func (builder *CondBuilder) Or(sub func(sub *CondBuilder)) *CondBuilder
func (*CondBuilder) X ¶ added in v0.5.1
func (builder *CondBuilder) X(k string, vs ...interface{}) *CondBuilder
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
*
- ASC: orderBy > last | 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
}
type SourceBuilder ¶
type SourceBuilder struct {
// contains filtered or unexported fields
}
func (*SourceBuilder) Alia ¶
func (sb *SourceBuilder) Alia(alia string) *SourceBuilder
func (*SourceBuilder) Cond ¶ added in v0.5.2
func (sb *SourceBuilder) Cond(on func(on *On)) *SourceBuilder
func (*SourceBuilder) Join ¶ added in v0.5.1
func (sb *SourceBuilder) Join(join JOIN) *SourceBuilder
func (*SourceBuilder) ON ¶ added in v0.5.2
func (sb *SourceBuilder) ON(onStr string) *SourceBuilder
func (*SourceBuilder) Source ¶
func (sb *SourceBuilder) Source(po Po) *SourceBuilder
func (*SourceBuilder) Sub ¶
func (sb *SourceBuilder) Sub(sub *BuilderX) *SourceBuilder
func (*SourceBuilder) USING ¶ added in v0.5.2
func (sb *SourceBuilder) USING(key string) *SourceBuilder