From b691cbbd34767e7e83a6c853c5f690ed95b53c1b Mon Sep 17 00:00:00 2001 From: x-ream <8966188@qq.com> Date: Mon, 15 Jul 2024 18:23:15 +0800 Subject: [PATCH] InsertBuilder should set string defaut for sqlx Select() (#78) --- builder_insert.go | 3 --- builder_x.go | 2 +- to_sql.go | 4 ++-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/builder_insert.go b/builder_insert.go index 689ab53..0085f54 100644 --- a/builder_insert.go +++ b/builder_insert.go @@ -49,9 +49,6 @@ func (b *InsertBuilder) Set(k string, v interface{}) *InsertBuilder { switch v.(type) { case string: - if v.(string) == "" { - return b - } case uint64, uint, int64, int, int32, int16, int8, bool, byte, float64, float32: if v == 0 { return b diff --git a/builder_x.go b/builder_x.go index fe611df..1c43080 100644 --- a/builder_x.go +++ b/builder_x.go @@ -18,7 +18,7 @@ package sqlxb import "fmt" -// To build sql, like: SELECT DISTINCT f.id FROM foo f INNER_JOIN JOIN (SELECT foo_id FROM bar) b ON b.foo_id = f.id +// ToId build sql, like: SELECT DISTINCT f.id FROM foo f INNER_JOIN JOIN (SELECT foo_id FROM bar) b ON b.foo_id = f.id // Sql for MySQL, Clickhouse.... // // @author Sim diff --git a/to_sql.go b/to_sql.go index 9a470f7..10440c7 100644 --- a/to_sql.go +++ b/to_sql.go @@ -266,7 +266,7 @@ func (built *Built) countBuilder() *strings.Builder { func (built *Built) SqlOfPage() (string, string, []interface{}, map[string]string) { vs := []interface{}{} - km := make(map[string]string) //nil for sub From builder, + km := make(map[string]string) //nil for sub FromId builder, dataSql, kmp := built.sqlData(&vs, km) countSql := built.sqlCount() @@ -275,7 +275,7 @@ func (built *Built) SqlOfPage() (string, string, []interface{}, map[string]strin func (built *Built) SqlOfSelect() (string, []interface{}, map[string]string) { vs := []interface{}{} - km := make(map[string]string) //nil for sub From builder, + km := make(map[string]string) //nil for sub FromId builder, dataSql, kmp := built.sqlData(&vs, km) return dataSql, vs, kmp }