-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yangyile
committed
Dec 9, 2024
1 parent
72321b8
commit 2fc2001
Showing
8 changed files
with
427 additions
and
40 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package gormcnqs | ||
|
||
import ( | ||
"github.com/yyle88/gormcnm" | ||
"github.com/yyle88/gormcnm/internal/utils" | ||
"gorm.io/gorm" | ||
) | ||
|
||
func OK() bool { | ||
return stub.OK() | ||
} | ||
func CreateCondition(stmt string, args ...interface{}) *gormcnm.QxConjunction { | ||
return stub.CreateCondition(stmt, args...) | ||
} | ||
func NewQx(stmt string, args ...interface{}) *gormcnm.QxConjunction { | ||
return stub.NewQx(stmt, args...) | ||
} | ||
func Qx(stmt string, args ...interface{}) *gormcnm.QxConjunction { | ||
return stub.Qx(stmt, args...) | ||
} | ||
func CreateSelect(stmt string, args ...interface{}) *gormcnm.SelectStatement { | ||
return stub.CreateSelect(stmt, args...) | ||
} | ||
func NewSx(stmt string, args ...interface{}) *gormcnm.SelectStatement { | ||
return stub.NewSx(stmt, args...) | ||
} | ||
func Sx(stmt string, args ...interface{}) *gormcnm.SelectStatement { | ||
return stub.Sx(stmt, args...) | ||
} | ||
func NewColumnValueMap() gormcnm.ColumnValueMap { | ||
return stub.NewColumnValueMap() | ||
} | ||
func NewKw() gormcnm.ColumnValueMap { | ||
return stub.NewKw() | ||
} | ||
func CreateColumnValueMap(columnName string, value interface{}) gormcnm.ColumnValueMap { | ||
return stub.CreateColumnValueMap(columnName, value) | ||
} | ||
func Kw(columnName string, value interface{}) gormcnm.ColumnValueMap { | ||
return stub.Kw(columnName, value) | ||
} | ||
func Where(db *gorm.DB, qxs ...*gormcnm.QxConjunction) *gorm.DB { | ||
return stub.Where(db, qxs...) | ||
} | ||
func OrderByColumns(db *gorm.DB, obs ...gormcnm.OrderByBottle) *gorm.DB { | ||
return stub.OrderByColumns(db, obs...) | ||
} | ||
func UpdateColumns(db *gorm.DB, kws ...gormcnm.ColumnValueMap) *gorm.DB { | ||
return stub.UpdateColumns(db, kws...) | ||
} | ||
func CombineColumnNames(a ...utils.ColumnNameInterface) string { | ||
return stub.CombineColumnNames(a...) | ||
} | ||
func MergeNames(a ...utils.ColumnNameInterface) string { | ||
return stub.MergeNames(a...) | ||
} | ||
func CombineStatements(a ...string) string { | ||
return stub.CombineStatements(a...) | ||
} | ||
func MergeStmts(a ...string) string { | ||
return stub.MergeStmts(a...) | ||
} | ||
func CountStmt(alias string) string { | ||
return stub.CountStmt(alias) | ||
} | ||
func CountCaseWhenStmt(condition string, alias string) string { | ||
return stub.CountCaseWhenStmt(condition, alias) | ||
} | ||
func CountCaseWhenQxSx(qx *gormcnm.QxConjunction, alias string) *gormcnm.SelectStatement { | ||
return stub.CountCaseWhenQxSx(qx, alias) | ||
} | ||
func CombineSelectStatements(cs ...gormcnm.SelectStatement) *gormcnm.SelectStatement { | ||
return stub.CombineSelectStatements(cs...) | ||
} | ||
func CombineSxs(cs ...gormcnm.SelectStatement) *gormcnm.SelectStatement { | ||
return stub.CombineSxs(cs...) | ||
} | ||
func Select(db *gorm.DB, qxs ...*gormcnm.SelectStatement) *gorm.DB { | ||
return stub.Select(db, qxs...) | ||
} | ||
func LEFTJOIN(tableName string) *gormcnm.TableJoin { | ||
return stub.LEFTJOIN(tableName) | ||
} | ||
func RIGHTJOIN(tableName string) *gormcnm.TableJoin { | ||
return stub.RIGHTJOIN(tableName) | ||
} | ||
func INNERJOIN(tableName string) *gormcnm.TableJoin { | ||
return stub.INNERJOIN(tableName) | ||
} | ||
func CROSSJOIN(tableName string) *gormcnm.TableJoin { | ||
return stub.CROSSJOIN(tableName) | ||
} |
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,29 @@ | ||
package gormcnqs | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/yyle88/must" | ||
"github.com/yyle88/runpath" | ||
"github.com/yyle88/runpath/runtestpath" | ||
"github.com/yyle88/sure/cls_stub_gen" | ||
"github.com/yyle88/syntaxgo" | ||
"github.com/yyle88/syntaxgo/syntaxgo_ast" | ||
"github.com/yyle88/syntaxgo/syntaxgo_reflect" | ||
) | ||
|
||
func TestGen(t *testing.T) { | ||
packageName := syntaxgo_reflect.GetPkgNameV4(stub) | ||
must.Equals("gormcnm", packageName) | ||
|
||
cfg := &cls_stub_gen.StubGenConfig{ | ||
SourceRootPath: runpath.PARENT.UpTo(2, packageName), | ||
TargetPackageName: syntaxgo.CurrentPackageName(), | ||
ImportOptions: syntaxgo_ast.NewPackageImportOptions(), | ||
OutputPath: runtestpath.SrcPath(t), | ||
AllowFileCreation: false, | ||
} | ||
|
||
param := cls_stub_gen.NewStubParam(stub, "stub") | ||
cls_stub_gen.GenerateStubs(cfg, param) | ||
} |
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,5 @@ | ||
package gormcnqs | ||
|
||
import "github.com/yyle88/gormcnm" | ||
|
||
var stub = &gormcnm.ColumnOperationClass{} |
Oops, something went wrong.