sql

package
v0.0.0-...-0ce9a7c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector struct {
	ConnectionString string
}

Connector stores connection information for the SQL Server instance and contains instance methods that can run SQL queries and commands

func (Connector) CreateLogin

func (c Connector) CreateLogin(username string, password string) error

CreateLogin connects to the SQL Database to create a login with the provided credentials

func (Connector) DeleteLogin

func (c Connector) DeleteLogin(username string) error

DeleteLogin connects to the SQL Database and removes a login with the provided username, if it exists. If it does not exist, this is a noop.

func (Connector) Execute

func (c Connector) Execute(command string, args ...interface{}) error

Execute an SQL statement and ignore the results

func (Connector) GetLogin

func (c Connector) GetLogin(username string) (*Login, error)

GetLogin reads a login from the SQL Database, if it exists. If it does not, no error is returned, but the returned Login is nil

func (Connector) Query

func (c Connector) Query(query string, scanner func(*sql.Rows) error, args ...interface{}) error

Query the database

func (Connector) UpdateLogin

func (c Connector) UpdateLogin(username string, password string) error

UpdateLogin updates the password of a login, if it exists.

type Login

type Login struct {
	Username    string
	PrincipalID int64
}

Login represents an SQL Server Login

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL