Skip to content

Latest commit

 

History

History
31 lines (24 loc) · 708 Bytes

README.md

File metadata and controls

31 lines (24 loc) · 708 Bytes

GORM SQL Server Driver

USAGE

import (
  "gorm.io/driver/sqlserver"
  "gorm.io/gorm"
)

// github.com/microsoft/go-mssqldb
dsn := "sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm"
db, err := gorm.Open(sqlserver.Open(dsn), &gorm.Config{})

Azure AD Auth

import (
  "github.com/microsoft/go-mssqldb/azuread"
  "gorm.io/driver/sqlserver"
  "gorm.io/gorm"
)

// github.com/microsoft/go-mssqldb
dsn := "sqlserver://gorm:LoremIpsum86@localhost:9930?database=gorm"
dialector := &sqlserver.Dialector{Config: &sqlserver.Config{DSN: dsn, DriverName: azuread.DriverName}}
db, err := gorm.Open(dialector, &gorm.Config{})

Checkout https://gorm.io for details.