Documentation ¶
Index ¶
- func AddTestFact()
- func AddTestUser()
- func ConnectDatabase(dbname string)
- func CreateDatabaseTables()
- func MigrateDatabaseTables()
- func Special()
- type DatabaseStorage
- func (s *DatabaseStorage) CreateAccount(a *account.Account) error
- func (s *DatabaseStorage) CreateFact(f *fact.Fact) error
- func (s *DatabaseStorage) DeleteFact(f *fact.Fact) error
- func (s *DatabaseStorage) GetVoteForFact(accountId int64, factId int64) (*fact.Vote, error)
- func (s *DatabaseStorage) GiveOneVoteToAllAccounts() error
- func (s *DatabaseStorage) ListFacts(accountId int64, viewUnmoderated bool) ([]fact.Fact, error)
- func (s *DatabaseStorage) LoadAccountFromEmail(email string) (*account.Account, error)
- func (s *DatabaseStorage) LoadAccountFromId(id int64) (*account.Account, error)
- func (s *DatabaseStorage) LoadAccountFromSession(sessionId string) (*account.Account, error)
- func (s *DatabaseStorage) LoadFactFromId(id int64) (*fact.Fact, error)
- func (s *DatabaseStorage) ModerateFact(f *fact.Fact, enable bool) error
- func (s *DatabaseStorage) SaveAccount(a *account.Account) error
- func (s *DatabaseStorage) SaveVote(v *fact.Vote) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTestFact ¶
func AddTestFact()
func AddTestUser ¶
func AddTestUser()
func ConnectDatabase ¶
func ConnectDatabase(dbname string)
this is responsible for the creation of the connection to the database it routes the connection through GORM, the Go ORM manager
func CreateDatabaseTables ¶
func CreateDatabaseTables()
this function is designed to be called to create the database tables when the appropriate flag is set if any tables preexist they will be dropped
func MigrateDatabaseTables ¶
func MigrateDatabaseTables()
Types ¶
type DatabaseStorage ¶
type DatabaseStorage struct {
// contains filtered or unexported fields
}
var DbStorage DatabaseStorage
func (*DatabaseStorage) CreateAccount ¶
func (s *DatabaseStorage) CreateAccount(a *account.Account) error
func (*DatabaseStorage) CreateFact ¶
func (s *DatabaseStorage) CreateFact(f *fact.Fact) error
func (*DatabaseStorage) DeleteFact ¶
func (s *DatabaseStorage) DeleteFact(f *fact.Fact) error
func (*DatabaseStorage) GetVoteForFact ¶
Record a vote against a fact. Return the vote, and any applicable error.
func (*DatabaseStorage) GiveOneVoteToAllAccounts ¶
func (s *DatabaseStorage) GiveOneVoteToAllAccounts() error
func (*DatabaseStorage) LoadAccountFromEmail ¶
func (s *DatabaseStorage) LoadAccountFromEmail(email string) (*account.Account, error)
Loads an account given a username
func (*DatabaseStorage) LoadAccountFromId ¶
func (s *DatabaseStorage) LoadAccountFromId(id int64) (*account.Account, error)
Loads an account given an ID
func (*DatabaseStorage) LoadAccountFromSession ¶
func (s *DatabaseStorage) LoadAccountFromSession(sessionId string) (*account.Account, error)
func (*DatabaseStorage) LoadFactFromId ¶
func (s *DatabaseStorage) LoadFactFromId(id int64) (*fact.Fact, error)
func (*DatabaseStorage) ModerateFact ¶
func (s *DatabaseStorage) ModerateFact(f *fact.Fact, enable bool) error
func (*DatabaseStorage) SaveAccount ¶
func (s *DatabaseStorage) SaveAccount(a *account.Account) error
Click to show internal directories.
Click to hide internal directories.