gorm_oracle.go 350 B

123456789101112131415161718
  1. package config
  2. import (
  3. "fmt"
  4. "net"
  5. "net/url"
  6. )
  7. type Oracle struct {
  8. GeneralDB `yaml:",inline" mapstructure:",squash"`
  9. }
  10. func (m *Oracle) Dsn() string {
  11. dsn := fmt.Sprintf("oracle://%s:%s@%s/%s?%s", url.PathEscape(m.Username), url.PathEscape(m.Password),
  12. net.JoinHostPort(m.Path, m.Port), url.PathEscape(m.Dbname), m.Config)
  13. return dsn
  14. }