fyidb

package
v0.0.0-...-2feadb7 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2017 License: MIT Imports: 11 Imported by: 1

Documentation

Index

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()

func Special

func Special()

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

func (s *DatabaseStorage) GetVoteForFact(accountId int64, factId int64) (*fact.Vote, error)

Record a vote against a fact. Return the vote, and any applicable error.

func (*DatabaseStorage) GiveOneVoteToAllAccounts

func (s *DatabaseStorage) GiveOneVoteToAllAccounts() error

func (*DatabaseStorage) ListFacts

func (s *DatabaseStorage) ListFacts(accountId int64, viewUnmoderated bool) ([]fact.Fact, 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

func (*DatabaseStorage) SaveVote

func (s *DatabaseStorage) SaveVote(v *fact.Vote) error

Jump to

Keyboard shortcuts

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