Documentation
¶
Index ¶
- Constants
- func ConnectToDB(ctx context.Context, serverAddress string, database string, port int, ...) (*sql.DB, error)
- func ConnectToDBUsingAAD(ctx context.Context, serverAddress string, database string, port int, ...) (*sql.DB, error)
- func CreateOrUpdateAADUser(ctx context.Context, db *sql.DB, username string) error
- func CreateOrUpdateUser(ctx context.Context, db *sql.DB, username string, password string) error
- func DoesUserExist(ctx context.Context, db *sql.DB, username string) (bool, error)
- func DropUser(ctx context.Context, db *sql.DB, username string) error
- func GetUserRoles(ctx context.Context, db *sql.DB, user string) (set.Set[string], error)
- func ReconcileUserRoles(ctx context.Context, db *sql.DB, user string, roles []string) error
- type SQLRoleDelta
Constants ¶
View Source
const ServerPort = 1433
ServerPort is the default server port for sql server
Variables ¶
This section is empty.
Functions ¶
func ConnectToDB ¶
func ConnectToDBUsingAAD ¶
func ConnectToDBUsingAAD( ctx context.Context, serverAddress string, database string, port int, tokenProvider func() (string, error), ) (*sql.DB, error)
ConnectToDBUsingAAD connects to the Azure SQL database using the specified token provider. TODO: Does this work for any form of user? Don't need a username at all?
func CreateOrUpdateAADUser ¶
CreateOrUpdateAADUser creates or updates an AAD user. See https://learn.microsoft.com/en-us/azure/azure-sql/database/authentication-aad-configure for details on how to create AAD users. username can be either the actual AAD username (for real AAD users), the group name for groups, or the managed identity name (app) for managed identities.
func CreateOrUpdateUser ¶
func DoesUserExist ¶
DoesUserExist checks if db contains user
func GetUserRoles ¶
GetUserRoles gets the roles assigned t othe user
Types ¶
Click to show internal directories.
Click to hide internal directories.