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.
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 (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) SourceBuilder() *SourceBuilder
- func (builder *BuilderX) WithoutOptimization() *BuilderX
- type Built
- type ConditionBuilder
- func (builder *ConditionBuilder) And(subCondition *ConditionBuilder) *ConditionBuilder
- func (builder *ConditionBuilder) Bool(preCondition BoolFunc, then func(cb *ConditionBuilder)) *ConditionBuilder
- func (builder *ConditionBuilder) Build() *Built
- func (builder *ConditionBuilder) Eq(k string, v interface{}) *ConditionBuilder
- func (builder *ConditionBuilder) Gt(k string, v interface{}) *ConditionBuilder
- func (builder *ConditionBuilder) Gte(k string, v interface{}) *ConditionBuilder
- func (builder *ConditionBuilder) In(k string, vs ...interface{}) *ConditionBuilder
- func (builder *ConditionBuilder) IsNull(key string) *ConditionBuilder
- func (builder *ConditionBuilder) Like(k string, v string) *ConditionBuilder
- func (builder *ConditionBuilder) LikeRight(k string, v string) *ConditionBuilder
- func (builder *ConditionBuilder) Lt(k string, v interface{}) *ConditionBuilder
- func (builder *ConditionBuilder) Lte(k string, v interface{}) *ConditionBuilder
- func (builder *ConditionBuilder) Ne(k string, v interface{}) *ConditionBuilder
- func (builder *ConditionBuilder) Nin(k string, vs ...interface{}) *ConditionBuilder
- func (builder *ConditionBuilder) NonNull(key string) *ConditionBuilder
- func (builder *ConditionBuilder) NotLike(k string, v string) *ConditionBuilder
- func (builder *ConditionBuilder) OR() *ConditionBuilder
- func (builder *ConditionBuilder) Or(sub *ConditionBuilder) *ConditionBuilder
- func (builder *ConditionBuilder) X(k string, vs ...interface{}) *ConditionBuilder
- 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) JoinOn(join JOIN, on *On) *SourceBuilder
- func (sb *SourceBuilder) JoinUsing(join JOIN, key string) *SourceBuilder
- func (sb *SourceBuilder) More(cb *ConditionBuilder)
- func (sb *SourceBuilder) Source(po Po) *SourceBuilder
- func (sb *SourceBuilder) Sub(sub *BuilderX) *SourceBuilder
- type StringId
Constants ¶
const ( X = "" 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 {
ConditionBuilder
// 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() *PageBuilder
type BuilderX ¶
type BuilderX struct {
Builder
// contains filtered or unexported fields
}
func NewBuilderX ¶
func Sub ¶
func Sub() *BuilderX
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 (*BuilderX) ResultKeys ¶
func (*BuilderX) SourceBuilder ¶
func (x *BuilderX) SourceBuilder() *SourceBuilder
func (*BuilderX) WithoutOptimization ¶
type Built ¶
type Built struct {
ResultKeys []string
ConditionX []Bb
Sorts []Sort
Havings []Bb
GroupBys []string
Sbs []*SourceBuilder
Svs []interface{}
PageCondition *PageCondition
Po Po
}
func (*Built) SqlOfCondition ¶
type ConditionBuilder ¶
type ConditionBuilder struct {
// contains filtered or unexported fields
}
func SubCondition ¶
func SubCondition() *ConditionBuilder
func (*ConditionBuilder) And ¶
func (builder *ConditionBuilder) And(subCondition *ConditionBuilder) *ConditionBuilder
func (*ConditionBuilder) Bool ¶
func (builder *ConditionBuilder) Bool(preCondition BoolFunc, then func(cb *ConditionBuilder)) *ConditionBuilder
func (*ConditionBuilder) Build ¶
func (builder *ConditionBuilder) Build() *Built
func (*ConditionBuilder) Eq ¶
func (builder *ConditionBuilder) Eq(k string, v interface{}) *ConditionBuilder
func (*ConditionBuilder) Gt ¶
func (builder *ConditionBuilder) Gt(k string, v interface{}) *ConditionBuilder
func (*ConditionBuilder) Gte ¶
func (builder *ConditionBuilder) Gte(k string, v interface{}) *ConditionBuilder
func (*ConditionBuilder) In ¶
func (builder *ConditionBuilder) In(k string, vs ...interface{}) *ConditionBuilder
func (*ConditionBuilder) IsNull ¶
func (builder *ConditionBuilder) IsNull(key string) *ConditionBuilder
func (*ConditionBuilder) Like ¶
func (builder *ConditionBuilder) Like(k string, v string) *ConditionBuilder
func (*ConditionBuilder) LikeRight ¶
func (builder *ConditionBuilder) LikeRight(k string, v string) *ConditionBuilder
func (*ConditionBuilder) Lt ¶
func (builder *ConditionBuilder) Lt(k string, v interface{}) *ConditionBuilder
func (*ConditionBuilder) Lte ¶
func (builder *ConditionBuilder) Lte(k string, v interface{}) *ConditionBuilder
func (*ConditionBuilder) Ne ¶
func (builder *ConditionBuilder) Ne(k string, v interface{}) *ConditionBuilder
func (*ConditionBuilder) Nin ¶
func (builder *ConditionBuilder) Nin(k string, vs ...interface{}) *ConditionBuilder
func (*ConditionBuilder) NonNull ¶
func (builder *ConditionBuilder) NonNull(key string) *ConditionBuilder
func (*ConditionBuilder) NotLike ¶
func (builder *ConditionBuilder) NotLike(k string, v string) *ConditionBuilder
func (*ConditionBuilder) OR ¶
func (builder *ConditionBuilder) OR() *ConditionBuilder
func (*ConditionBuilder) Or ¶
func (builder *ConditionBuilder) Or(sub *ConditionBuilder) *ConditionBuilder
func (*ConditionBuilder) X ¶
func (builder *ConditionBuilder) X(k string, vs ...interface{}) *ConditionBuilder
type PageBuilder ¶
type PageBuilder struct {
// contains filtered or unexported fields
}
func (*PageBuilder) IgnoreTotalRows ¶
func (pb *PageBuilder) IgnoreTotalRows(ignored bool) *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) Paged ¶
func (pb *PageBuilder) Paged() *PageBuilder
func (*PageBuilder) Rows ¶
func (pb *PageBuilder) Rows(rows uint) *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) JoinOn ¶
func (sb *SourceBuilder) JoinOn(join JOIN, on *On) *SourceBuilder
func (*SourceBuilder) JoinUsing ¶
func (sb *SourceBuilder) JoinUsing(join JOIN, key string) *SourceBuilder
func (*SourceBuilder) More ¶
func (sb *SourceBuilder) More(cb *ConditionBuilder)
func (*SourceBuilder) Source ¶
func (sb *SourceBuilder) Source(po Po) *SourceBuilder
func (*SourceBuilder) Sub ¶
func (sb *SourceBuilder) Sub(sub *BuilderX) *SourceBuilder