|
|
@@ -14,11 +14,18 @@ type InsertExecuteParams struct {
|
|
|
*TableRows
|
|
|
}
|
|
|
|
|
|
-// TODO 判断Err
|
|
|
-
|
|
|
func (params InsertExecuteParams) Map() (map[string]any, error) {
|
|
|
+ if params.TableRows == nil {
|
|
|
+ return nil, nil
|
|
|
+ }
|
|
|
+
|
|
|
+ if params.TableRows.err != nil {
|
|
|
+ return nil, params.TableRows.err
|
|
|
+ }
|
|
|
+
|
|
|
columns := make([]string, 0)
|
|
|
values := make([]any, 0)
|
|
|
+
|
|
|
for _, row := range params.TableRows.Rows {
|
|
|
columns = append(columns, row.Column)
|
|
|
values = append(values, row.Value)
|
|
|
@@ -48,6 +55,10 @@ func (params DeleteExecuteParams) Map() (map[string]any, error) {
|
|
|
return nil, errors.New("没有传递删除条件")
|
|
|
}
|
|
|
|
|
|
+ if params.Conditions.err != nil {
|
|
|
+ return nil, params.Conditions.err
|
|
|
+ }
|
|
|
+
|
|
|
return map[string]any{
|
|
|
"table_name": params.TableName,
|
|
|
"conditions": params.Conditions.Conditions,
|
|
|
@@ -70,6 +81,14 @@ type UpdateExecuteParams struct {
|
|
|
}
|
|
|
|
|
|
func (params UpdateExecuteParams) Map() (map[string]any, error) {
|
|
|
+ if params.TableRows == nil {
|
|
|
+ return nil, nil
|
|
|
+ }
|
|
|
+
|
|
|
+ if params.TableRows.err != nil {
|
|
|
+ return nil, params.TableRows.err
|
|
|
+ }
|
|
|
+
|
|
|
setList := make([]string, 0)
|
|
|
for _, row := range params.TableRows.Rows {
|
|
|
setList = append(setList, row.Column+" = "+row.Value)
|
|
|
@@ -77,6 +96,10 @@ func (params UpdateExecuteParams) Map() (map[string]any, error) {
|
|
|
|
|
|
conditions := make([]string, 0)
|
|
|
if params.Conditions != nil {
|
|
|
+ if params.Conditions.err != nil {
|
|
|
+ return nil, params.Conditions.err
|
|
|
+ }
|
|
|
+
|
|
|
conditions = params.Conditions.Conditions
|
|
|
}
|
|
|
|
|
|
@@ -117,6 +140,10 @@ func (params QueryExecuteParams) Map() (map[string]any, error) {
|
|
|
|
|
|
conditions := make([]string, 0)
|
|
|
if params.Conditions != nil {
|
|
|
+ if params.Conditions.err != nil {
|
|
|
+ return nil, params.Conditions.err
|
|
|
+ }
|
|
|
+
|
|
|
conditions = params.Conditions.Conditions
|
|
|
}
|
|
|
|
|
|
@@ -138,6 +165,10 @@ type QueryOneExecuteParams struct {
|
|
|
func (params QueryOneExecuteParams) Map() (map[string]any, error) {
|
|
|
conditions := make([]string, 0)
|
|
|
if params.Conditions != nil {
|
|
|
+ if params.Conditions.err != nil {
|
|
|
+ return nil, params.Conditions.err
|
|
|
+ }
|
|
|
+
|
|
|
conditions = params.Conditions.Conditions
|
|
|
}
|
|
|
|
|
|
@@ -165,6 +196,10 @@ type CountExecuteParams struct {
|
|
|
func (params CountExecuteParams) Map() (map[string]any, error) {
|
|
|
conditions := make([]string, 0)
|
|
|
if params.Conditions != nil {
|
|
|
+ if params.Conditions.err != nil {
|
|
|
+ return nil, params.Conditions.err
|
|
|
+ }
|
|
|
+
|
|
|
conditions = params.Conditions.Conditions
|
|
|
}
|
|
|
|
|
|
@@ -182,6 +217,10 @@ type CheckExistExecuteParams struct {
|
|
|
func (params CheckExistExecuteParams) Map() (map[string]any, error) {
|
|
|
conditions := make([]string, 0)
|
|
|
if params.Conditions != nil {
|
|
|
+ if params.Conditions.err != nil {
|
|
|
+ return nil, params.Conditions.err
|
|
|
+ }
|
|
|
+
|
|
|
conditions = params.Conditions.Conditions
|
|
|
}
|
|
|
|
|
|
@@ -199,6 +238,10 @@ type CheckHasOnlyOneExecuteParams struct {
|
|
|
func (params CheckHasOnlyOneExecuteParams) Map() (map[string]any, error) {
|
|
|
conditions := make([]string, 0)
|
|
|
if params.Conditions != nil {
|
|
|
+ if params.Conditions.err != nil {
|
|
|
+ return nil, params.Conditions.err
|
|
|
+ }
|
|
|
+
|
|
|
conditions = params.Conditions.Conditions
|
|
|
}
|
|
|
|