feat: update tools

This commit is contained in:
Rogee
2025-05-28 19:38:03 +08:00
parent 3b902509f7
commit 099bdfc7d9
2 changed files with 20 additions and 4 deletions

19
.vscode/settings.json vendored
View File

@@ -1,3 +1,20 @@
{ {
"editor.fontSize": 10 "editor.fontSize": 10,
"dbcode.connections": [
{
"connectionId": "l6fEOogu2kQt5G3BashDt",
"name": "10.1.1.2",
"driver": "postgres",
"connectionType": "host",
"host": "10.1.1.2",
"port": 5432,
"ssl": false,
"username": "postgres",
"password": "",
"savePassword": "secretStorage",
"database": "quyun",
"readOnly": false,
"connectionTimeout": 30
}
]
} }

View File

@@ -43,7 +43,7 @@ func (m *{{.PascalTable}}) Create(ctx context.Context) error {
{{- end}} {{- end}}
stmt := tblMedias.INSERT(tbl{{.PascalTable}}.MutableColumns).MODEL(m).RETURNING(tblMedias.AllColumns) stmt := tbl{{.PascalTable}}.INSERT(tbl{{.PascalTable}}.MutableColumns).MODEL(m).RETURNING(tbl{{.PascalTable}}.AllColumns)
m.log().WithField("func","Create").Info( stmt.DebugSql()) m.log().WithField("func","Create").Info( stmt.DebugSql())
if err := stmt.QueryContext(ctx, db, m); err != nil { if err := stmt.QueryContext(ctx, db, m); err != nil {
@@ -207,8 +207,7 @@ func (m *{{.PascalTable}}) GetByID(ctx context.Context, id int64, conds ...Cond)
func (m *{{.PascalTable}}) Count(ctx context.Context, conds ...Cond) (int64, error) { func (m *{{.PascalTable}}) Count(ctx context.Context, conds ...Cond) (int64, error) {
cond := CondTrue(conds...) cond := CondTrue(conds...)
tbl := tbl{{.PascalTable}} stmt := tbl{{.PascalTable}}.SELECT(COUNT(tbl{{.PascalTable}}.ID).AS("count")).WHERE(cond)
stmt := tbl.SELECT(COUNT(tbl.ID).AS("count")).WHERE(cond)
m.log().Infof("sql: %s", stmt.DebugSql()) m.log().Infof("sql: %s", stmt.DebugSql())
var count struct { var count struct {