mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-29 10:57:44 +09:00 
			
		
		
		
	Added all required dependencies
This commit is contained in:
		
							
								
								
									
										74
									
								
								vendor/github.com/go-xorm/builder/cond.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								vendor/github.com/go-xorm/builder/cond.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | ||||
| package builder | ||||
|  | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"io" | ||||
| ) | ||||
|  | ||||
| type Writer interface { | ||||
| 	io.Writer | ||||
| 	Append(...interface{}) | ||||
| } | ||||
|  | ||||
| type stringWriter struct { | ||||
| 	writer *bytes.Buffer | ||||
| 	buffer []byte | ||||
| 	args   []interface{} | ||||
| } | ||||
|  | ||||
| func NewWriter() *stringWriter { | ||||
| 	w := &stringWriter{} | ||||
| 	w.writer = bytes.NewBuffer(w.buffer) | ||||
| 	return w | ||||
| } | ||||
|  | ||||
| func (s *stringWriter) Write(buf []byte) (int, error) { | ||||
| 	return s.writer.Write(buf) | ||||
| } | ||||
|  | ||||
| func (s *stringWriter) Append(args ...interface{}) { | ||||
| 	s.args = append(s.args, args...) | ||||
| } | ||||
|  | ||||
| type Cond interface { | ||||
| 	WriteTo(Writer) error | ||||
| 	And(...Cond) Cond | ||||
| 	Or(...Cond) Cond | ||||
| 	IsValid() bool | ||||
| } | ||||
|  | ||||
| type condEmpty struct{} | ||||
|  | ||||
| var _ Cond = condEmpty{} | ||||
|  | ||||
| func NewCond() Cond { | ||||
| 	return condEmpty{} | ||||
| } | ||||
|  | ||||
| func (condEmpty) WriteTo(w Writer) error { | ||||
| 	return nil | ||||
| } | ||||
|  | ||||
| func (condEmpty) And(conds ...Cond) Cond { | ||||
| 	return And(conds...) | ||||
| } | ||||
|  | ||||
| func (condEmpty) Or(conds ...Cond) Cond { | ||||
| 	return Or(conds...) | ||||
| } | ||||
|  | ||||
| func (condEmpty) IsValid() bool { | ||||
| 	return false | ||||
| } | ||||
|  | ||||
| func condToSQL(cond Cond) (string, []interface{}, error) { | ||||
| 	if cond == nil || !cond.IsValid() { | ||||
| 		return "", nil, nil | ||||
| 	} | ||||
|  | ||||
| 	w := NewWriter() | ||||
| 	if err := cond.WriteTo(w); err != nil { | ||||
| 		return "", nil, err | ||||
| 	} | ||||
| 	return w.writer.String(), w.args, nil | ||||
| } | ||||
		Reference in New Issue
	
	Block a user