test

package
v0.1.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProjectRepository

func NewProjectRepository(canQuery bool) repository.ProjectRepository

NewProjectRepository will return errors if canQuery is false

func NewRepoClientRepository

func NewRepoClientRepository(canQuery bool) repository.RepoClientRepository

NewRepoClientRepository will return errors if canQuery is false

func NewRepository

func NewRepository(canQuery bool) *repository.Repository

NewRepository returns a Repository which persists users in memory and accepts a parameter that can trigger read/write errors

func NewServiceAccountRepository

func NewServiceAccountRepository(canQuery bool) repository.ServiceAccountRepository

NewServiceAccountRepository will return errors if canQuery is false

func NewSessionRepository

func NewSessionRepository(canQuery bool) repository.SessionRepository

NewSessionRepository returns pointer to repo along with the db

func NewUserRepository

func NewUserRepository(canQuery bool) repository.UserRepository

NewUserRepository will return errors if canQuery is false

Types

type ProjectRepository

type ProjectRepository struct {
	// contains filtered or unexported fields
}

ProjectRepository will return errors on queries if canQuery is false and only stores a small set of projects in-memory that are indexed by their array index + 1

func (*ProjectRepository) CreateProject

func (repo *ProjectRepository) CreateProject(project *models.Project) (*models.Project, error)

CreateProject appends a new project to the in-memory projects array

func (*ProjectRepository) CreateProjectRole

func (repo *ProjectRepository) CreateProjectRole(project *models.Project, role *models.Role) (*models.Role, error)

CreateProjectRole appends a role to the existing array of roles

func (*ProjectRepository) DeleteProject

func (repo *ProjectRepository) DeleteProject(project *models.Project) (*models.Project, error)

DeleteProject removes a project

func (*ProjectRepository) ListProjectsByUserID

func (repo *ProjectRepository) ListProjectsByUserID(userID uint) ([]*models.Project, error)

ListProjectsByUserID lists projects where a user has an associated role

func (*ProjectRepository) ReadProject

func (repo *ProjectRepository) ReadProject(id uint) (*models.Project, error)

ReadProject gets a projects specified by a unique id

type RepoClientRepository

type RepoClientRepository struct {
	// contains filtered or unexported fields
}

RepoClientRepository implements repository.RepoClientRepository

func (*RepoClientRepository) CreateRepoClient

func (repo *RepoClientRepository) CreateRepoClient(rc *models.RepoClient) (*models.RepoClient, error)

CreateRepoClient creates a new repo client and appends it to the in-memory list

func (*RepoClientRepository) ListRepoClientsByProjectID

func (repo *RepoClientRepository) ListRepoClientsByProjectID(projectID uint) ([]*models.RepoClient, error)

ListRepoClientsByProjectID returns a list of repo clients that match a project id

func (*RepoClientRepository) ReadRepoClient

func (repo *RepoClientRepository) ReadRepoClient(id uint) (*models.RepoClient, error)

ReadRepoClient returns a repo client by id

type ServiceAccountRepository

type ServiceAccountRepository struct {
	// contains filtered or unexported fields
}

ServiceAccountRepository implements repository.ServiceAccountRepository

func (*ServiceAccountRepository) CreateServiceAccount

func (repo *ServiceAccountRepository) CreateServiceAccount(
	sa *models.ServiceAccount,
) (*models.ServiceAccount, error)

CreateServiceAccount creates a new servicea account

func (*ServiceAccountRepository) CreateServiceAccountCandidate

func (repo *ServiceAccountRepository) CreateServiceAccountCandidate(
	saCandidate *models.ServiceAccountCandidate,
) (*models.ServiceAccountCandidate, error)

CreateServiceAccountCandidate creates a new service account candidate

func (*ServiceAccountRepository) ListServiceAccountCandidatesByProjectID

func (repo *ServiceAccountRepository) ListServiceAccountCandidatesByProjectID(
	projectID uint,
) ([]*models.ServiceAccountCandidate, error)

ListServiceAccountCandidatesByProjectID finds all service account candidates for a given project id

func (*ServiceAccountRepository) ListServiceAccountsByProjectID

func (repo *ServiceAccountRepository) ListServiceAccountsByProjectID(
	projectID uint,
) ([]*models.ServiceAccount, error)

ListServiceAccountsByProjectID finds all service accounts for a given project id

func (*ServiceAccountRepository) ReadServiceAccount

func (repo *ServiceAccountRepository) ReadServiceAccount(
	id uint,
) (*models.ServiceAccount, error)

ReadServiceAccount finds a service account by id

func (*ServiceAccountRepository) ReadServiceAccountCandidate

func (repo *ServiceAccountRepository) ReadServiceAccountCandidate(
	id uint,
) (*models.ServiceAccountCandidate, error)

ReadServiceAccountCandidate finds a service account candidate by id

func (*ServiceAccountRepository) UpdateServiceAccountCandidateCreatedSAID

func (repo *ServiceAccountRepository) UpdateServiceAccountCandidateCreatedSAID(
	id uint,
	createdSAID uint,
) (*models.ServiceAccountCandidate, error)

UpdateServiceAccountCandidateCreatedSAID updates the CreatedServiceAccountID for a candidate, after the candidate has been resolved.

func (*ServiceAccountRepository) UpdateServiceAccountTokenCache

func (repo *ServiceAccountRepository) UpdateServiceAccountTokenCache(
	tokenCache *models.TokenCache,
) (*models.ServiceAccount, error)

UpdateServiceAccountTokenCache updates the token cache for a service account

type SessionRepository

type SessionRepository struct {
	// contains filtered or unexported fields
}

SessionRepository uses gorm.DB for querying the database

func (*SessionRepository) CreateSession

func (repo *SessionRepository) CreateSession(session *models.Session) (*models.Session, error)

CreateSession must take in Key, Data, and ExpiresAt as arguments.

func (*SessionRepository) DeleteSession

func (repo *SessionRepository) DeleteSession(session *models.Session) (*models.Session, error)

DeleteSession deletes a session by Key

func (*SessionRepository) SelectSession

func (repo *SessionRepository) SelectSession(session *models.Session) (*models.Session, error)

SelectSession returns a session with matching key

func (*SessionRepository) UpdateSession

func (repo *SessionRepository) UpdateSession(session *models.Session) (*models.Session, error)

UpdateSession updates only the Data field using Key as selector.

type UserRepository

type UserRepository struct {
	// contains filtered or unexported fields
}

UserRepository will return errors on queries if canQuery is false and only stores a small set of users in-memory that are indexed by their array index + 1

func (*UserRepository) CheckPassword

func (repo *UserRepository) CheckPassword(id int, pwd string) (bool, error)

CheckPassword checks the input password is correct for the provided user id.

func (*UserRepository) CreateUser

func (repo *UserRepository) CreateUser(user *models.User) (*models.User, error)

CreateUser adds a new User row to the Users table in array memory

func (*UserRepository) DeleteUser

func (repo *UserRepository) DeleteUser(user *models.User) (*models.User, error)

DeleteUser deletes a single user using their unique id

func (*UserRepository) ReadUser

func (repo *UserRepository) ReadUser(id uint) (*models.User, error)

ReadUser finds a single user based on their unique id

func (*UserRepository) ReadUserByEmail

func (repo *UserRepository) ReadUserByEmail(email string) (*models.User, error)

ReadUserByEmail finds a single user based on their unique email

func (*UserRepository) UpdateUser

func (repo *UserRepository) UpdateUser(user *models.User) (*models.User, error)

UpdateUser modifies an existing User in the database

Jump to

Keyboard shortcuts

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