Skip to content

Instantly share code, notes, and snippets.

@fgoinai
Created July 22, 2017 13:01
Show Gist options
  • Save fgoinai/43726311482ce1455b51e62d38a4a2de to your computer and use it in GitHub Desktop.
Save fgoinai/43726311482ce1455b51e62d38a4a2de to your computer and use it in GitHub Desktop.
//以下是SQL Builder...
type stmtOption interface{}
type stdOption struct{
stmtOption
params []string
}
type selectB stdOption
...
type joinB {
stmtOption
param map[string][]string
}
...
type SqlBuilder struct {
opQueue []stmtOption //Javaer在此微笑
}
func (b *SqlBuilder) Select(xs ...string) *SqlBuilder {
b.opQueue = append(b.opQueue, selectB{params: xs}) //来,都排好队,build时才一次过处理
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment