/mssql

Microsoft SQL server adapter for REL written in Golang.

Primary LanguageGoMIT LicenseMIT

mssql

GoDoc Integration Go Report Card codecov Gitter chat

Microsoft SQL Server adapter for REL.

Example

package main

import (
	"context"

	_ "github.com/denisenkom/go-mssqldb"
	"github.com/go-rel/mssql"
	"github.com/go-rel/rel"
)

func main() {
	// open mssql connection.
	adapter, err := mssql.Open("sqlserver://sa:REL2021-mssql@localhost:1433?database=rel")
	if err != nil {
		panic(err)
	}
	defer adapter.Close()

	// initialize REL's repo.
	repo := rel.New(adapter)
	repo.Ping(context.TODO())
}

Supported Driver

  • github.com/denisenkom/go-mssqldb

Supported Database

  • Microsoft SQL Server 2017
  • Microsoft SQL Server 2019

Testing

Start Microsoft SQL server in Docker

docker run -it --rm -p 1434:1433 -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=REL2021-mssql" -e "MSSQL_PID=Developer"  mcr.microsoft.com/mssql/server:2019-latest

Run tests

MSSQL_DATABASE="sqlserver://sa:REL2021-mssql@localhost:1434" go test ./...