postgres

package
v0.3.0-dev.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPostgresDataAccess

func NewPostgresDataAccess(configs data.DatabaseConfigs) dal.DataAccess

NewPostgresDataAccess will create and return a new PostgresDataAccess instance.

Types

type PostgresDataAccess

type PostgresDataAccess struct {
	dal.DataAccess
	// contains filtered or unexported fields
}

PostgresDataAccess is a data access implementation backed by a database.

func (PostgresDataAccess) GroupAddUser

func (da PostgresDataAccess) GroupAddUser(groupname string, username string) error

GroupAddUser adds a user to a group

func (PostgresDataAccess) GroupCreate

func (da PostgresDataAccess) GroupCreate(group rest.Group) error

GroupCreate creates a new user group.

func (PostgresDataAccess) GroupDelete

func (da PostgresDataAccess) GroupDelete(groupname string) error

GroupDelete deletes a group.

func (PostgresDataAccess) GroupExists

func (da PostgresDataAccess) GroupExists(groupname string) (bool, error)

GroupExists is used to determine whether a group exists in the data store.

func (PostgresDataAccess) GroupGet

func (da PostgresDataAccess) GroupGet(groupname string) (rest.Group, error)

GroupGet gets a specific group.

func (PostgresDataAccess) GroupGrantRole

func (da PostgresDataAccess) GroupGrantRole() error

GroupGrantRole grants one or more roles to a group.

func (PostgresDataAccess) GroupList

func (da PostgresDataAccess) GroupList() ([]rest.Group, error)

GroupList returns a list of all known groups in the datastore. Passwords are not included. Nice try.

func (PostgresDataAccess) GroupListUsers

func (da PostgresDataAccess) GroupListUsers(groupname string) ([]rest.User, error)

GroupListUsers returns a list of all known users in a group.

func (PostgresDataAccess) GroupRemoveUser

func (da PostgresDataAccess) GroupRemoveUser(groupname string, username string) error

GroupRemoveUser removes a user from a group.

func (PostgresDataAccess) GroupRevokeRole

func (da PostgresDataAccess) GroupRevokeRole() error

GroupRevokeRole revokes a role from a group.

func (PostgresDataAccess) GroupUpdate

func (da PostgresDataAccess) GroupUpdate(group rest.Group) error

GroupUpdate is used to update an existing group. An error is returned if the groupname is empty or if the group doesn't exist. TODO Should we let this create groups that don't exist?

func (PostgresDataAccess) GroupUserAdd

func (da PostgresDataAccess) GroupUserAdd(group string, user string) error

GroupUserAdd comments TBD

func (PostgresDataAccess) GroupUserDelete

func (da PostgresDataAccess) GroupUserDelete(group string, user string) error

GroupUserDelete comments TBD

func (PostgresDataAccess) GroupUserList

func (da PostgresDataAccess) GroupUserList(group string) ([]rest.User, error)

GroupUserList comments TBD

func (PostgresDataAccess) Initialize

func (da PostgresDataAccess) Initialize() error

Initialize sets up the database.

func (PostgresDataAccess) TokenEvaluate

func (da PostgresDataAccess) TokenEvaluate(tokenString string) bool

TokenEvaluate will test a token for validity. It returns true if the token exists and is still within its valid period; false otherwise.

func (PostgresDataAccess) TokenGenerate

func (da PostgresDataAccess) TokenGenerate(username string, duration time.Duration) (rest.Token, error)

TokenGenerate generates a new token for the given user with a specified expiration duration. Any existing token for this user will be automatically invalidated. If the user doesn't exist an error is returned.

func (PostgresDataAccess) TokenInvalidate

func (da PostgresDataAccess) TokenInvalidate(tokenString string) error

TokenInvalidate immediately invalidates the specified token. An error is returned if the token doesn't exist.

func (PostgresDataAccess) TokenRetrieveByToken

func (da PostgresDataAccess) TokenRetrieveByToken(tokenString string) (rest.Token, error)

TokenRetrieveByToken retrieves the token by its value. An error is returned if no such token exists.

func (PostgresDataAccess) TokenRetrieveByUser

func (da PostgresDataAccess) TokenRetrieveByUser(username string) (rest.Token, error)

TokenRetrieveByUser retrieves the token associated with a username. An error is returned if no such token (or user) exists.

func (PostgresDataAccess) UserAuthenticate

func (da PostgresDataAccess) UserAuthenticate(username string, password string) (bool, error)

UserAuthenticate authenticates a username/password combination.

func (PostgresDataAccess) UserCreate

func (da PostgresDataAccess) UserCreate(user rest.User) error

UserCreate is used to create a new Cog user in the data store. An error is returned if the username is empty or if a user already exists.

func (PostgresDataAccess) UserDelete

func (da PostgresDataAccess) UserDelete(username string) error

UserDelete deletes an existing user from the data store. An error is returned if the username parameter is empty or if the user doesn't exist.

func (PostgresDataAccess) UserExists

func (da PostgresDataAccess) UserExists(username string) (bool, error)

UserExists is used to determine whether a Cog user with the given username exists in the data store.

func (PostgresDataAccess) UserGet

func (da PostgresDataAccess) UserGet(username string) (rest.User, error)

UserGet returns a user from the data store. An error is returned if the username parameter is empty or if the user doesn't exist.

func (PostgresDataAccess) UserGroupAdd

func (da PostgresDataAccess) UserGroupAdd(username string, groupname string) error

UserGroupAdd comments TBD

func (PostgresDataAccess) UserGroupDelete

func (da PostgresDataAccess) UserGroupDelete(username string, groupname string) error

UserGroupDelete comments TBD

func (PostgresDataAccess) UserGroupList

func (da PostgresDataAccess) UserGroupList(user string) ([]rest.Group, error)

UserGroupList comments TBD

func (PostgresDataAccess) UserList

func (da PostgresDataAccess) UserList() ([]rest.User, error)

UserList returns a list of all known users in the datastore. Passwords are not included. Nice try.

func (PostgresDataAccess) UserUpdate

func (da PostgresDataAccess) UserUpdate(user rest.User) error

UserUpdate is used to update an existing user. An error is returned if the username is empty or if the user doesn't exist. TODO Should we let this create users that don't exist?

Jump to

Keyboard shortcuts

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