store

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: GPL-3.0 Imports: 36 Imported by: 8

Documentation

Overview

Package store holds everything that has to do with persistence and manages stored data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeDatabase

func InitializeDatabase()

InitializeDatabase initializes the database connection and makes sure the database schema is up to date

func InitializeTestDatabase added in v1.7.0

func InitializeTestDatabase()

InitializeTestDatabase initializes an empty database for tests

Types

type ActivitySQL

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

func GetActivityStore

func GetActivityStore() ActivitySQL

func (ActivitySQL) GetActivitiesForProjectLimitFromOffset

func (activitySQL ActivitySQL) GetActivitiesForProjectLimitFromOffset(projectId int64, limit int, offset int) ([]*activity.Activity, error)

* Gets 20 activities from the database.

func (ActivitySQL) LogActivity

func (activitySql ActivitySQL) LogActivity(activityType int, entities *activity.ActivityEntities, request *http.Request) error

type AssignmentSQL

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

func (AssignmentSQL) Create

func (assignmentSQL AssignmentSQL) Create(session *xorm.Session, activityType int, activityEntities *activity.ActivityEntities, request *http.Request) (int64, error)

func (AssignmentSQL) GetLazyLoadedActivityItem

func (assignmentSQL AssignmentSQL) GetLazyLoadedActivityItem(activity *activity.Activity) (activity.ActivityItem, error)

type CasesSQL added in v1.7.0

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

func GetCaseStore

func GetCaseStore() CasesSQL

GetCaseStore returns a store for test cases

func (CasesSQL) Add added in v1.7.0

func (csSQL CasesSQL) Add(testCase *test.Case) error

func (CasesSQL) Delete added in v1.7.0

func (csSQL CasesSQL) Delete(testCase *test.Case) error

func (CasesSQL) Exists added in v1.7.0

func (csSQL CasesSQL) Exists(tID id.TestID) (bool, error)

func (CasesSQL) Get added in v1.7.0

func (csSQL CasesSQL) Get(tID id.TestID) (*test.Case, bool, error)

func (CasesSQL) List added in v1.7.0

func (csSQL CasesSQL) List(pID id.ProjectID) ([]*test.Case, error)

func (CasesSQL) Rename added in v1.7.0

func (csSQL CasesSQL) Rename(old, new id.TestID) error

type CommentsSQL added in v1.7.0

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

func GetCommentStore added in v1.7.0

func GetCommentStore() CommentsSQL

func (CommentsSQL) DeleteCommentsForTest added in v1.7.0

func (commentsSql CommentsSQL) DeleteCommentsForTest(testObject interface{}) error

func (CommentsSQL) GetComment added in v1.7.0

func (commentsSql CommentsSQL) GetComment(commentId int64, project *project.Project) (*comment.Comment, error)

func (CommentsSQL) GetCommentsForTest added in v1.7.0

func (commentsSql CommentsSQL) GetCommentsForTest(testObject interface{}, project *project.Project, requester *user.User) ([]*comment.Comment, error)

Gets comments for a testObject and fills them with users. CAUTION: YOU MAY NOT PASS POINTERS TO CASES/SEQUENCES. DEREFERENCE THEM WITH *

func (CommentsSQL) InsertComment added in v1.7.0

func (commentsSql CommentsSQL) InsertComment(comment *comment.Comment, testObject interface{}, user *user.User) error

Generates foreign keys for a comment and inserts it into the db. CAUTION: YOU MAY NOT PASS POINTERS TO CASES/SEQUENCES. DEREFERENCE THEM WITH *

func (CommentsSQL) UpdateComment added in v1.7.0

func (commentsSql CommentsSQL) UpdateComment(comment *comment.Comment) error

type GroupSQL added in v1.7.0

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

func GetGroupStore

func GetGroupStore() GroupSQL

GetGroupStore returns a store for groups

func (GroupSQL) Add added in v1.7.0

func (s GroupSQL) Add(g *group.Group) error

func (GroupSQL) Get added in v1.7.0

func (s GroupSQL) Get(id id.ActorID) (*group.Group, bool, error)

func (GroupSQL) List added in v1.7.0

func (s GroupSQL) List() ([]*group.Group, error)

type LabelsSQL

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

func GetLabelStore

func GetLabelStore() LabelsSQL

func (LabelsSQL) DeleteLabel

func (labelsSql LabelsSQL) DeleteLabel(labelId int64) error

Permanently deletes a label

func (LabelsSQL) DeleteTestLabel

func (labelsSql LabelsSQL) DeleteTestLabel(labelId int64, testId int64, projectId int64, isCase bool) error

Permanently deletes a test label

func (LabelsSQL) GetAllTestLabels

func (labelsSql LabelsSQL) GetAllTestLabels() ([]*project.TestLabel, error)

func (LabelsSQL) GetLabelsForProject

func (labelsSql LabelsSQL) GetLabelsForProject(testProject *project.Project) ([]*project.Label, error)

PROJECT ------------------------------------------------------------------------------------------------------------|

func (LabelsSQL) GetLabelsForTest

func (labelsSql LabelsSQL) GetLabelsForTest(testObject interface{}, projectId int64) ([]*project.Label, error)

func (LabelsSQL) InsertTestLabel

func (labelsSql LabelsSQL) InsertTestLabel(labelId int64, testId int64, projectId int64, isCase bool) error

func (LabelsSQL) UpdateLabelForProject

func (labelsSql LabelsSQL) UpdateLabelForProject(label *project.Label, projectId int64) (int64, error)

type OwnersSQL added in v1.7.0

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

func GetActorExistenceChecker

func GetActorExistenceChecker() OwnersSQL

GetActorExistenceChecker returns the implementation to use for ActorExistenceChecker

func (OwnersSQL) Exists added in v1.7.0

func (s OwnersSQL) Exists(id id.ActorID) (bool, error)

type ProjectsSQL added in v1.7.0

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

func GetProjectStore

func GetProjectStore() ProjectsSQL

GetProjectStore returns a store for projects

func (ProjectsSQL) Add added in v1.7.0

func (psSQL ProjectsSQL) Add(p *project.Project) error

func (ProjectsSQL) AddIssue

func (psSQL ProjectsSQL) AddIssue(issue integration.GitLabIssue) error

func (ProjectsSQL) Delete added in v1.7.0

func (psSQL ProjectsSQL) Delete(pID id.ProjectID) error

func (ProjectsSQL) Exists added in v1.7.0

func (psSQL ProjectsSQL) Exists(pID id.ProjectID) (bool, error)

func (ProjectsSQL) Get added in v1.7.0

func (psSQL ProjectsSQL) Get(pID id.ProjectID) (*project.Project, bool, error)

func (ProjectsSQL) GetIssue

func (psSQL ProjectsSQL) GetIssue(testCaseID id.TestID, version string, variant string) (*integration.GitLabIssue, error)

func (ProjectsSQL) ListAll added in v1.7.0

func (psSQL ProjectsSQL) ListAll() ([]*project.Project, error)

ListAll lists all projects in the system

func (ProjectsSQL) ListForActor added in v1.7.0

func (psSQL ProjectsSQL) ListForActor(actor id.ActorID) ([]*project.Project, error)

ListForActor returns all projects the actor has access to

func (ProjectsSQL) ListForMember added in v1.7.0

func (psSQL ProjectsSQL) ListForMember(member id.ActorID) ([]*project.Project, error)

ListForMember returns all projects where the given actor is a member

func (ProjectsSQL) ListForOwner added in v1.7.0

func (psSQL ProjectsSQL) ListForOwner(owner id.ActorID) ([]*project.Project, error)

ListForOwner lists all projects where the given actor is the owner

func (ProjectsSQL) ListInternal added in v1.7.0

func (psSQL ProjectsSQL) ListInternal() ([]*project.Project, error)

ListInternal lists all internal projects

func (ProjectsSQL) ListPrivate added in v1.7.0

func (psSQL ProjectsSQL) ListPrivate(actor id.ActorID) ([]*project.Project, error)

ListPrivate lists all private projects where the given actor is the owner

func (ProjectsSQL) ListPublic added in v1.7.0

func (psSQL ProjectsSQL) ListPublic() ([]*project.Project, error)

ListPublic lists all public projects

func (ProjectsSQL) RenameProjectVariant

func (psSQL ProjectsSQL) RenameProjectVariant(p *project.Project, version, oldVariantName, newVariantName string) error

func (ProjectsSQL) RenameProjectVersion

func (psSQL ProjectsSQL) RenameProjectVersion(p *project.Project, oldVersionName, newVersionName string) error

type ProtocolsSQL added in v1.7.0

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

func GetProtocolStore added in v1.1.0

func GetProtocolStore() ProtocolsSQL

GetProtocolStore returns a store for protocols

func (ProtocolsSQL) AddCaseProtocol added in v1.7.0

func (prSQL ProtocolsSQL) AddCaseProtocol(caseExecProtocol *test.CaseExecutionProtocol, testCaseVersion test.CaseVersion) (err error)

AddCaseProtocol stores a test.CaseExecutionProtocol

func (ProtocolsSQL) AddSequenceProtocol added in v1.7.0

func (prSQL ProtocolsSQL) AddSequenceProtocol(r *test.SequenceExecutionProtocol, sequenceVersion test.SequenceVersion) (err error)

AddSequenceProtocol stores a test.SequenceExecutionProtocol in the database

func (ProtocolsSQL) GetCaseExecutionProtocol added in v1.7.0

func (prSQL ProtocolsSQL) GetCaseExecutionProtocol(protocolID id.ProtocolID) (test.CaseExecutionProtocol, error)

func (ProtocolsSQL) GetCaseExecutionProtocols added in v1.7.0

func (prSQL ProtocolsSQL) GetCaseExecutionProtocols(testcaseID id.TestID) ([]test.CaseExecutionProtocol, error)

GetCaseExecutionProtocols returns a slice of all CaseExecutionProtocols that belong to the given test case.

func (ProtocolsSQL) GetCaseExecutionProtocolsForProject added in v1.7.0

func (prSQL ProtocolsSQL) GetCaseExecutionProtocolsForProject(projectID id.ProjectID) ([]test.CaseExecutionProtocol, error)

GetCaseExecutionProtocolsForProject returns a slice of all CaseExecutionProtocols, that belongs to the given project.

func (ProtocolsSQL) GetPartiallyLoadedCaseExecutionProtocol

func (protocolsSQL ProtocolsSQL) GetPartiallyLoadedCaseExecutionProtocol(caseExecutionProtocolId int64) (*test.CaseExecutionProtocol, error)

func (ProtocolsSQL) GetPartiallyLoadedSequenceExecutionProtocol

func (protocolsSQL ProtocolsSQL) GetPartiallyLoadedSequenceExecutionProtocol(sequenceExecutionProtocolId int64) (*test.SequenceExecutionProtocol, error)

func (ProtocolsSQL) GetSequenceExecutionProtocol added in v1.7.0

func (protocolsSQL ProtocolsSQL) GetSequenceExecutionProtocol(protocolID id.ProtocolID) (test.SequenceExecutionProtocol, error)

func (ProtocolsSQL) GetSequenceExecutionProtocols added in v1.7.0

func (prSQL ProtocolsSQL) GetSequenceExecutionProtocols(testID id.TestID) ([]test.SequenceExecutionProtocol, error)

GetSequenceExecutionProtocols returns a slice of all SequenceExecutionProtocol that belong to a given sequence, identified by the id.TestID

func (ProtocolsSQL) GetSequenceExecutionProtocolsForProject added in v1.7.0

func (prSQL ProtocolsSQL) GetSequenceExecutionProtocolsForProject(projectID id.ProjectID) ([]test.SequenceExecutionProtocol, error)

GetSequenceExecutionProtocolsForProject returns a slice of SequenceExecutionProtocols related to a given id.ProjectID

func (ProtocolsSQL) GetTestVersionProtocols added in v1.7.0

func (prSQL ProtocolsSQL) GetTestVersionProtocols(testVersionID id.TestVersionID) ([]id.ProtocolID, error)

GetTestVersionProtocols returns a slice of all execution protocols ids for a testVersion

type SequencesSQL added in v1.7.0

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

func GetSequenceStore

func GetSequenceStore() SequencesSQL

GetSequenceStore returns a store for test sequences

func (SequencesSQL) Add added in v1.7.0

func (s SequencesSQL) Add(ts *test.Sequence) error

func (SequencesSQL) Delete added in v1.7.0

func (s SequencesSQL) Delete(testSequence *test.Sequence) error

func (SequencesSQL) Exists added in v1.7.0

func (s SequencesSQL) Exists(tID id.TestID) (bool, error)

func (SequencesSQL) Get added in v1.7.0

func (s SequencesSQL) Get(tID id.TestID) (*test.Sequence, bool, error)

func (SequencesSQL) List added in v1.7.0

func (s SequencesSQL) List(pID id.ProjectID) ([]*test.Sequence, error)

func (SequencesSQL) Rename added in v1.7.0

func (s SequencesSQL) Rename(old, new id.TestID) error

type SystemSettingsSQL added in v1.7.0

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

func GetSystemSettingsStore added in v1.7.0

func GetSystemSettingsStore() SystemSettingsSQL

func (SystemSettingsSQL) GetSystemSettings added in v1.7.0

func (SystemSettingsSQL SystemSettingsSQL) GetSystemSettings() (*system.SystemSettings, error)

func (SystemSettingsSQL) InsertSystemSettings added in v1.7.0

func (SystemSettingsSQL SystemSettingsSQL) InsertSystemSettings(systemSettings *system.SystemSettings) error

func (SystemSettingsSQL) UpdateSystemSettings added in v1.7.0

func (SystemSettingsSQL SystemSettingsSQL) UpdateSystemSettings(systemSettings *system.SystemSettings) error

type TaskSQL added in v1.7.0

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

func GetTaskStore added in v1.7.0

func GetTaskStore() TaskSQL

GetTaskStore returns a store for Tasks

func (TaskSQL) Add added in v1.7.0

func (taskSQL TaskSQL) Add(list task.List) error

func (TaskSQL) AddItem

func (taskSQL TaskSQL) AddItem(item task.Item) error

AddItem adds the given item to the store

func (TaskSQL) Get added in v1.7.0

func (taskSQL TaskSQL) Get(username string) (*task.List, error)

func (TaskSQL) GetTasksForTest

func (taskSQL TaskSQL) GetTasksForTest(testID id.TestID) ([]*task.Item, error)

GetTasksForTest retrieves the users from open tasks for a test, identified by the testID

type TestCreationSQL

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

func (TestCreationSQL) Create

func (testCreationSQL TestCreationSQL) Create(session *xorm.Session, activityType int, activityEntities *activity.ActivityEntities, request *http.Request) (int64, error)

func (TestCreationSQL) GetLazyLoadedActivityItem

func (testCreationSQL TestCreationSQL) GetLazyLoadedActivityItem(activity *activity.Activity) (activity.ActivityItem, error)

type TestProtocolSQL

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

func (TestProtocolSQL) Create

func (testProtocolSQL TestProtocolSQL) Create(session *xorm.Session, activityType int, activityEntities *activity.ActivityEntities, request *http.Request) (int64, error)

func (TestProtocolSQL) GetLazyLoadedActivityItem

func (testProtocolSQL TestProtocolSQL) GetLazyLoadedActivityItem(activity *activity.Activity) (activity.ActivityItem, error)

type UsersSQL added in v1.7.0

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

func GetUserStore

func GetUserStore() UsersSQL

GetUserStore returns a store for users

func (UsersSQL) Add added in v1.7.0

func (us UsersSQL) Add(u *user.PasswordUser) error

func (UsersSQL) Deactivate

func (us UsersSQL) Deactivate(u *user.User, isDelete bool) error

func (UsersSQL) Get added in v1.7.0

func (us UsersSQL) Get(uID id.ActorID) (*user.User, bool, error)

func (UsersSQL) GetByMail added in v1.7.0

func (us UsersSQL) GetByMail(mail string) (*user.User, bool, error)

func (UsersSQL) List added in v1.7.0

func (us UsersSQL) List() ([]*user.User, error)

func (UsersSQL) Update

func (us UsersSQL) Update(u *user.User) error

func (UsersSQL) Validate added in v1.7.0

func (us UsersSQL) Validate(identifier, password string) (*user.User, bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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