Documentation ¶
Index ¶
- type Database
- type MockDB
- func (m *MockDB) AllBadWords() (models.BadWords, error)
- func (m *MockDB) AllCommits() (models.GitCommits, error)
- func (m *MockDB) AllGroupTerms() (models.GroupTerms, error)
- func (m *MockDB) Close()
- func (m *MockDB) GetOrCreateCommit(commit *models.GitCommit) error
- func (m *MockDB) GetOrCreateRepo(repo *models.GitRepo) error
- func (m *MockDB) GetOrCreateUser(user *models.GitUser) error
- func (m *MockDB) RandomSearchTerms() (models.SearchTerms, error)
- func (m *MockDB) RecentCommitsByGroup(group string) (models.GitCommits, error)
- func (m *MockDB) UpdateCommit(commit *models.GitCommit) error
- type SqliteDB
- func (s *SqliteDB) AllBadWords() (models.BadWords, error)
- func (s *SqliteDB) AllCommits() (models.GitCommits, error)
- func (s *SqliteDB) AllGroupTerms() (models.GroupTerms, error)
- func (s *SqliteDB) Close()
- func (s *SqliteDB) GetOrCreateCommit(commit *models.GitCommit) error
- func (s *SqliteDB) GetOrCreateRepo(repo *models.GitRepo) error
- func (s *SqliteDB) GetOrCreateUser(user *models.GitUser) error
- func (s *SqliteDB) RandomSearchTerms() (models.SearchTerms, error)
- func (s *SqliteDB) RecentCommitsByGroup(group string) (models.GitCommits, error)
- func (s *SqliteDB) UpdateCommit(commit *models.GitCommit) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { AllBadWords() (models.BadWords, error) AllGroupTerms() (models.GroupTerms, error) RandomSearchTerms() (models.SearchTerms, error) AllCommits() (models.GitCommits, error) UpdateCommit(commit *models.GitCommit) error RecentCommitsByGroup(group string) (models.GitCommits, error) GetOrCreateUser(user *models.GitUser) error GetOrCreateRepo(repo *models.GitRepo) error GetOrCreateCommit(commit *models.GitCommit) error Close() }
Database defines the behavior for the application's database.
type MockDB ¶
type MockDB struct { AllBadWordsMock func() (models.BadWords, error) AllGroupTermsMock func() (models.GroupTerms, error) RandomSearchTermsMock func() (models.SearchTerms, error) AllCommitsMock func() (models.GitCommits, error) UpdateCommitMock func(commit *models.GitCommit) error RecentCommitsByGroupMock func(group string) (models.GitCommits, error) GetOrCreateUserMock func(user *models.GitUser) error GetOrCreateRepoMock func(repo *models.GitRepo) error GetOrCreateCommitMock func(commit *models.GitCommit) error }
MockDB is an fake DB type that implements the Database interface. Used for testing.
func (*MockDB) AllBadWords ¶
AllBadWords ...
func (*MockDB) AllGroupTerms ¶
func (m *MockDB) AllGroupTerms() (models.GroupTerms, error)
AllGroupTerms ...
func (*MockDB) GetOrCreateCommit ¶
GetOrCreateCommit ...
func (*MockDB) GetOrCreateRepo ¶
GetOrCreateRepo ...
func (*MockDB) GetOrCreateUser ¶
GetOrCreateUser ...
func (*MockDB) RandomSearchTerms ¶
func (m *MockDB) RandomSearchTerms() (models.SearchTerms, error)
RandomSearchTerms ...
func (*MockDB) RecentCommitsByGroup ¶
func (m *MockDB) RecentCommitsByGroup(group string) (models.GitCommits, error)
RecentCommitsByGroup ...
type SqliteDB ¶
SqliteDB is an sqlite-backed type that implements the Database interface.
func NewSqliteDB ¶
NewSqliteDB connects to the database, and returns a new *SqliteDB type.
func (*SqliteDB) AllBadWords ¶
AllBadWords returns all the bad words.
func (*SqliteDB) AllCommits ¶
func (s *SqliteDB) AllCommits() (models.GitCommits, error)
AllCommits returns all the commits.
func (*SqliteDB) AllGroupTerms ¶
func (s *SqliteDB) AllGroupTerms() (models.GroupTerms, error)
AllGroupTerms returns all the group terms.
func (*SqliteDB) GetOrCreateCommit ¶
GetOrCreateCommit is a convenience method to get the provided Commit, or create it if it doesn't exist.
func (*SqliteDB) GetOrCreateRepo ¶
GetOrCreateRepo is a convenience method to get the provided Repo, or create it if it doesn't exist.
func (*SqliteDB) GetOrCreateUser ¶
GetOrCreateUser is a convenience method to get the provided User, or create it if it doesn't exist.
func (*SqliteDB) RandomSearchTerms ¶
func (s *SqliteDB) RandomSearchTerms() (models.SearchTerms, error)
RandomSearchTerms returns a list of randomly selected terms of predetermined rank.
func (*SqliteDB) RecentCommitsByGroup ¶
func (s *SqliteDB) RecentCommitsByGroup(group string) (models.GitCommits, error)
RecentCommitsByGroup returns the most recent commits.