Skip to content

mssql

import "github.com/go-rel/mssql"

Overview

Package mssql wraps mssql driver as an adapter for REL.

Constants

const Name string = "mssql"
Name of database type this adapter implements.

func MustOpen

func MustOpen(dsn string) rel.Adapter
MustOpen mssql connection using dsn.

func New

func New(db *db.DB) rel.Adapter
New mssql adapter using existing connection.

func Open

func Open(dsn string) (rel.Adapter, error)
Open mssql connection using dsn.

type MSSQL

type MSSQL struct {
    sql.SQL
}
MSSQL Adapter.

func (MSSQL) Begin

func (m MSSQL) Begin(ctx context.Context) (rel.Adapter, error)
Begin begins a new transaction.

func (MSSQL) Insert

func (m MSSQL) Insert(ctx context.Context, query rel.Query, primaryField string, mutates map[string]rel.Mutate, onConflict rel.OnConflict) (interface{}, error)
Insert inserts a record to database and returns its id.

func (MSSQL) InsertAll

func (m MSSQL) InsertAll(ctx context.Context, query rel.Query, primaryField string, fields []string, bulkMutates []map[string]rel.Mutate, onConflict rel.OnConflict) ([]interface{}, error)
InsertAll inserts multiple records to database and returns its ids.

func (MSSQL) Name

func (MSSQL) Name() string
Name of database adapter.


Last update: 2024-08-16