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

feat: Add more gorm-driver #138

Merged
merged 9 commits into from
Jun 4, 2021
Merged

feat: Add more gorm-driver #138

merged 9 commits into from
Jun 4, 2021

Conversation

GGXXLL
Copy link
Contributor

@GGXXLL GGXXLL commented May 27, 2021

No description provided.

@codecov
Copy link

codecov bot commented May 27, 2021

Codecov Report

Merging #138 (9da5675) into master (3669b37) will increase coverage by 0.07%.
The diff coverage is 100.00%.

❗ Current head 9da5675 differs from pull request most recent head 39277f8. Consider uploading reports for the commit 39277f8 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #138      +/-   ##
==========================================
+ Coverage   80.20%   80.28%   +0.07%     
==========================================
  Files          89       89              
  Lines        3840     3844       +4     
==========================================
+ Hits         3080     3086       +6     
+ Misses        561      559       -2     
  Partials      199      199              
Impacted Files Coverage Δ
otgorm/dependency.go 88.52% <100.00%> (+0.38%) ⬆️
config/remote/remote.go 85.18% <0.00%> (+7.40%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0a8a387...39277f8. Read the comment docs.

@Reasno
Copy link
Member

Reasno commented May 28, 2021

Not sure if we need them in this project. We are testing the config and tracing integration, not GORM itself. Those drivers belong to the tests in GORM project, not here. ie. As long as one of the drivers works, the integration of GORM works.

@GGXXLL
Copy link
Contributor Author

GGXXLL commented May 28, 2021

Not sure if we need them in this project. We are testing the config and tracing integration, not GORM itself. Those drivers belong to the tests in GORM project, not here. ie. As long as one of the drivers works, the integration of GORM works.

Yes, it does increase the cost of testing. So i just need to keep the following code?

func provideDialector(conf *databaseConf) (gorm.Dialector, error) {
	drivers := map[string]func(dsn string) gorm.Dialector{
		"mysql":      mysql.Open,
		"sqlite":     sqlite.Open,
		"postgres":   postgres.Open,
		"sqlserver":  sqlserver.Open,
		"clickhouse": clickhouse.Open,
	}
	if driver, ok := drivers[conf.Database]; ok {
		return driver(conf.Dsn), nil
	}
	return nil, fmt.Errorf("unknow database type %s", conf.Database)
}

@Reasno Reasno merged commit ec2c97c into DoNewsCode:master Jun 4, 2021
@GGXXLL GGXXLL deleted the otgorm-more-driver branch June 4, 2021 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants