Documentation
¶
Overview ¶
Package orm provides GORM dialector dispatch for 8 database drivers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dialector ¶
Dialector returns a gorm.Dialector for the given driver name and DSN. The 8 supported names are: mysql, postgres, tidb, mariadb, gaussdb, mssql, oracle, sqlite. TiDB and MariaDB wire-compatibly use the mysql dialector; GaussDB uses the postgres dialector.
func Open ¶
Open opens a *gorm.DB from a DialectorSource. Accepting a narrow interface keeps callers like dbsql.Open (which needs the full DBConfig) decoupled from callers like dbsql.OpenCluster (which only needs driver+DSN).
func SupportedDrivers ¶
func SupportedDrivers() []string
SupportedDrivers returns the list of supported driver names.
Types ¶
type DialectorSource ¶
DialectorSource is the minimal interface Open needs from a config: the driver name and the connection string. Every *XxxConfig in the config package already has both methods, so accepting a narrower interface here lets callers that don't need Validate/GetPool/GetTracing (e.g. a read/write-split cluster source) avoid implementing empty stubs.