-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from RyougiNevermore/master
fix generate bug at no go type expr
- Loading branch information
Showing
26 changed files
with
666 additions
and
645 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module github.com/pharosnet/dalc/cmd/dalc | ||
module github.com/pharosnet/dalc/cmd/dalc/v2 | ||
|
||
go 1.14 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
example/generated/dal/model.applications.business_code.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
// DO NOT EDIT THIS FILE, IT IS GENERATED BY DALC | ||
package dal | ||
|
||
import ( | ||
"context" | ||
"database/sql" | ||
"github.com/pharosnet/dalc/v2" | ||
"time" | ||
) | ||
|
||
const ( | ||
businessCodeRowGetByPkSQL = "SELECT `ID`, `CREATE_BY`, `CREATE_AT`, `MODIFY_BY`, `MODIFY_AT`, `DELETE_BY`, `DELETE_AT`, `VERSION`, `CODE`, `GROUP`, `DESCRIPTION`, `TEXT_CODE`FROM `APPLICATIONS`.`BUSINESS_CODE` WHERE `ID` = ?" | ||
businessCodeRowInsertSQL = "INSERT INTO `APPLICATIONS`.`BUSINESS_CODE` ( `ID`, `CREATE_BY`, `CREATE_AT`, `MODIFY_BY`, `MODIFY_AT`, `DELETE_BY`, `DELETE_AT`, `VERSION`, `CODE`, `GROUP`, `DESCRIPTION`, `TEXT_CODE`) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" | ||
businessCodeRowUpdateSQL = "UPDATE `APPLICATIONS`.`BUSINESS_CODE` SET `CREATE_BY` = ?, `CREATE_AT` = ?, `MODIFY_BY` = ?, `MODIFY_AT` = ?, `DELETE_BY` = ?, `DELETE_AT` = ?, `VERSION` = ?, `CODE` = ?, `GROUP` = ?, `DESCRIPTION` = ?, `TEXT_CODE` = ? WHERE `ID` = ?" | ||
businessCodeRowDeleteSQL = "DELETE FROM `APPLICATIONS`.`BUSINESS_CODE` WHERE `ID` = ?" | ||
) | ||
|
||
type BusinessCodeRow struct { | ||
Id string `json:"id"` | ||
CreateBy string `json:"create_by"` | ||
CreateAt time.Time `json:"create_at"` | ||
ModifyBy string `json:"modify_by"` | ||
ModifyAt time.Time `json:"modify_at"` | ||
DeleteBy string `json:"delete_by"` | ||
DeleteAt time.Time `json:"delete_at"` | ||
Version int64 `json:"version"` | ||
Code string `json:"code"` | ||
Group string `json:"group"` | ||
Description string `json:"description"` | ||
TextCode string `json:"text_code"` | ||
} | ||
|
||
func (row *BusinessCodeRow) scanSQLRow(rows *sql.Rows) (err error) { | ||
err = rows.Scan( | ||
&row.Id, | ||
&row.CreateBy, | ||
&row.CreateAt, | ||
&row.ModifyBy, | ||
&row.ModifyAt, | ||
&row.DeleteBy, | ||
&row.DeleteAt, | ||
&row.Version, | ||
&row.Code, | ||
&row.Group, | ||
&row.Description, | ||
&row.TextCode, | ||
) | ||
return | ||
} | ||
|
||
func (row *BusinessCodeRow) conventToGetArgs() (args *dalc.Args) { | ||
|
||
args = dalc.NewArgs() | ||
args.Arg(row.Id) | ||
|
||
return | ||
} | ||
|
||
func (row *BusinessCodeRow) Get(ctx dalc.PreparedContext) (err error) { | ||
err = dalc.Query(ctx, businessCodeRowGetByPkSQL, row.conventToGetArgs(), func(ctx context.Context, rows *sql.Rows, rowErr error) (err error) { | ||
if rowErr != nil { | ||
err = rowErr | ||
return | ||
} | ||
err = row.scanSQLRow(rows) | ||
return | ||
}) | ||
return | ||
} | ||
|
||
func (row *BusinessCodeRow) conventToInsertArgs() (args *dalc.Args) { | ||
|
||
args = dalc.NewArgs() | ||
args.Arg(row.Id) | ||
args.Arg(row.CreateBy) | ||
args.Arg(row.CreateAt) | ||
args.Arg(row.ModifyBy) | ||
args.Arg(row.ModifyAt) | ||
args.Arg(row.DeleteBy) | ||
args.Arg(row.DeleteAt) | ||
args.Arg(row.Version) | ||
args.Arg(row.Code) | ||
args.Arg(row.Group) | ||
args.Arg(row.Description) | ||
args.Arg(row.TextCode) | ||
|
||
return | ||
} | ||
|
||
func (row *BusinessCodeRow) Insert(ctx dalc.PreparedContext) (err error) { | ||
|
||
_, execErr := dalc.Execute(ctx, businessCodeRowInsertSQL, row.conventToInsertArgs()) | ||
if execErr != nil { | ||
err = execErr | ||
return | ||
} | ||
|
||
return | ||
} | ||
|
||
func (row *BusinessCodeRow) conventToUpdateArgs() (args *dalc.Args) { | ||
|
||
args = dalc.NewArgs() | ||
|
||
args.Arg(row.CreateBy) | ||
args.Arg(row.CreateAt) | ||
args.Arg(row.ModifyBy) | ||
args.Arg(row.ModifyAt) | ||
args.Arg(row.DeleteBy) | ||
args.Arg(row.DeleteAt) | ||
args.Arg(row.Version) | ||
args.Arg(row.Code) | ||
args.Arg(row.Group) | ||
args.Arg(row.Description) | ||
args.Arg(row.TextCode) | ||
|
||
args.Arg(row.Id) | ||
|
||
return | ||
} | ||
|
||
func (row *BusinessCodeRow) Update(ctx dalc.PreparedContext) (err error) { | ||
_, execErr := dalc.Execute(ctx, businessCodeRowUpdateSQL, row.conventToUpdateArgs()) | ||
if execErr != nil { | ||
err = execErr | ||
return | ||
} | ||
return | ||
} | ||
|
||
func (row *BusinessCodeRow) conventToDeleteArgs() (args *dalc.Args) { | ||
|
||
args = dalc.NewArgs() | ||
args.Arg(row.Id) | ||
|
||
return | ||
} | ||
|
||
func (row *BusinessCodeRow) Delete(ctx dalc.PreparedContext) (err error) { | ||
_, execErr := dalc.Execute(ctx, businessCodeRowDeleteSQL, row.conventToDeleteArgs()) | ||
if execErr != nil { | ||
err = execErr | ||
return | ||
} | ||
return | ||
} |
Oops, something went wrong.