Skip to content

mssql

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

Overview

Package mssql wraps mssql driver as an adapter for REL.

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.


Last update: 2022-06-25