package dao import ( "fmt" "strings" ) type Conditions *map[string]interface{} //TODO:未完成的sql语句构建器 type QuerySql struct { Table string Tail string Conditions Conditions Rebind int body string } func (b *QuerySql) Build() { if b.Conditions == nil { } var where []string var values []interface{} for k, v := range *b.Conditions { values = append(values, v) where = append(where, fmt.Sprintf(`"%s"=%s`, k, "?")) } b.body = "SELECT * FROM " + b.Table + " WHERE " + strings.Join(where, "AND") } func (b *QuerySql) String() { }