Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.10.5 #41

Merged
merged 5 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .github/workflows/cxflow.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/git-leak.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/security_allinone.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Security AllInOne
on:
push:
branches: '**'
branches:
- feature/*
pull_request:
types:
- opened
Expand Down
52 changes: 0 additions & 52 deletions .github/workflows/trivy.yml

This file was deleted.

20 changes: 16 additions & 4 deletions inssql/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ func Init(Driver, DBUser, DBPassword, DBHost, DBName string) (*sql.DB, error) {
return sqlClient, nil
}

var err error
sqlClient, err = New(Driver, DBUser, DBPassword, DBHost, DBName)

return sqlClient, err
}

// New creates brand new sql client
func New(Driver string, DBUser string, DBPassword string, DBHost string, DBName string) (*sql.DB, error) {
dsn := fmt.Sprintf(
"%v:%v@%v/%v?charset=utf8mb4&collation=utf8mb4_unicode_ci&parseTime=true",
DBUser,
Expand All @@ -33,8 +41,6 @@ func Init(Driver, DBUser, DBPassword, DBHost, DBName string) (*sql.DB, error) {
return nil, err
}

sqlClient = db

return db, err
}

Expand All @@ -49,12 +55,18 @@ func WrapWithGorm(sqlDB *sql.DB) (*gorm.DB, error) {
return gormClient, nil
}

var err error
gormClient, err = NewGorm(sqlDB)

return gormClient, err
}

// NewGorm wrap new sql client
func NewGorm(sqlDB *sql.DB) (*gorm.DB, error) {
gormDB, err := gorm.Open(mysql.New(mysql.Config{
Conn: sqlDB,
}), &gorm.Config{})

gormClient = gormDB

return gormDB, err
}

Expand Down
Loading