mirror of https://github.com/go-gitea/gitea
Git with a cup of tea, painless self-hosted git service
Mirror for internal git.with.parts use
https://git.with.parts
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.4 KiB
60 lines
1.4 KiB
8 years ago
|
// Copyright 2016 The Xorm Authors. All rights reserved.
|
||
|
// Use of this source code is governed by a BSD-style
|
||
|
// license that can be found in the LICENSE file.
|
||
|
|
||
8 years ago
|
package builder
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
8 years ago
|
// IsNull defines IS NULL condition
|
||
8 years ago
|
type IsNull [1]string
|
||
|
|
||
|
var _ Cond = IsNull{""}
|
||
|
|
||
8 years ago
|
// WriteTo write SQL to Writer
|
||
8 years ago
|
func (isNull IsNull) WriteTo(w Writer) error {
|
||
|
_, err := fmt.Fprintf(w, "%s IS NULL", isNull[0])
|
||
|
return err
|
||
|
}
|
||
|
|
||
8 years ago
|
// And implements And with other conditions
|
||
8 years ago
|
func (isNull IsNull) And(conds ...Cond) Cond {
|
||
|
return And(isNull, And(conds...))
|
||
|
}
|
||
|
|
||
8 years ago
|
// Or implements Or with other conditions
|
||
8 years ago
|
func (isNull IsNull) Or(conds ...Cond) Cond {
|
||
|
return Or(isNull, Or(conds...))
|
||
|
}
|
||
|
|
||
8 years ago
|
// IsValid tests if this condition is valid
|
||
8 years ago
|
func (isNull IsNull) IsValid() bool {
|
||
|
return len(isNull[0]) > 0
|
||
|
}
|
||
|
|
||
8 years ago
|
// NotNull defines NOT NULL condition
|
||
8 years ago
|
type NotNull [1]string
|
||
|
|
||
|
var _ Cond = NotNull{""}
|
||
|
|
||
8 years ago
|
// WriteTo write SQL to Writer
|
||
8 years ago
|
func (notNull NotNull) WriteTo(w Writer) error {
|
||
|
_, err := fmt.Fprintf(w, "%s IS NOT NULL", notNull[0])
|
||
|
return err
|
||
|
}
|
||
|
|
||
8 years ago
|
// And implements And with other conditions
|
||
8 years ago
|
func (notNull NotNull) And(conds ...Cond) Cond {
|
||
|
return And(notNull, And(conds...))
|
||
|
}
|
||
|
|
||
8 years ago
|
// Or implements Or with other conditions
|
||
8 years ago
|
func (notNull NotNull) Or(conds ...Cond) Cond {
|
||
|
return Or(notNull, Or(conds...))
|
||
|
}
|
||
|
|
||
8 years ago
|
// IsValid tests if this condition is valid
|
||
8 years ago
|
func (notNull NotNull) IsValid() bool {
|
||
|
return len(notNull[0]) > 0
|
||
|
}
|