Documentation ¶
Index ¶
- type Connection
- type MockConnection
- func (c *MockConnection) CreateTeam(team *Team) (Team, error)
- func (c *MockConnection) CreateToken(userID int) (Token, error)
- func (c *MockConnection) DeleteTeam(teamId int) error
- func (c *MockConnection) DeleteToken(tokenID int, userID int) error
- func (c *MockConnection) GetTeams(*int) (Teams, error)
- func (c *MockConnection) GetTeamsByActivation(string) (Teams, error)
- func (c *MockConnection) GetToken(tokenID int, userID int) (Token, error)
- func (c *MockConnection) GetUser(string) (Users, error)
- func (c *MockConnection) IsConnected() (bool, error)
- type PostgresSQL
- func (c *PostgresSQL) CreateTeam(team *Team) (Team, error)
- func (c *PostgresSQL) CreateToken(userID int) (Token, error)
- func (c *PostgresSQL) DeleteTeam(teamID int) error
- func (c *PostgresSQL) DeleteToken(tokenID int, userID int) error
- func (c *PostgresSQL) GetTeams(teamid *int) (Teams, error)
- func (c *PostgresSQL) GetTeamsByActivation(activation string) (Teams, error)
- func (c *PostgresSQL) GetToken(tokenID int, userID int) (Token, error)
- func (c *PostgresSQL) GetUser(username string) (Users, error)
- func (c *PostgresSQL) IsConnected() (bool, error)
- type Team
- type Teams
- type Token
- type User
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection interface { IsConnected() (bool, error) GetTeams(teamid *int) (Teams, error) GetTeamsByActivation(activation string) (Teams, error) CreateTeam(*Team) (Team, error) DeleteTeam(teamID int) error GetUser(username string) (Users, error) CreateToken(int) (Token, error) GetToken(int, int) (Token, error) DeleteToken(int, int) error }
func New ¶
func New(connection string) (Connection, error)
New creates a new connection to the database
type MockConnection ¶
func (*MockConnection) CreateTeam ¶
func (c *MockConnection) CreateTeam(team *Team) (Team, error)
CreateTeam -
func (*MockConnection) CreateToken ¶
func (c *MockConnection) CreateToken(userID int) (Token, error)
CreateToken -
func (*MockConnection) DeleteTeam ¶
func (c *MockConnection) DeleteTeam(teamId int) error
DeleteTeam -
func (*MockConnection) DeleteToken ¶
func (c *MockConnection) DeleteToken(tokenID int, userID int) error
DeleteToken -
func (*MockConnection) GetTeamsByActivation ¶
func (c *MockConnection) GetTeamsByActivation(string) (Teams, error)
GetTeamsByActivation -
func (*MockConnection) GetToken ¶
func (c *MockConnection) GetToken(tokenID int, userID int) (Token, error)
GetToken -
func (*MockConnection) IsConnected ¶
func (c *MockConnection) IsConnected() (bool, error)
IsConnected -
type PostgresSQL ¶
type PostgresSQL struct {
// contains filtered or unexported fields
}
func (*PostgresSQL) CreateTeam ¶
func (c *PostgresSQL) CreateTeam(team *Team) (Team, error)
CreateTeam creates a new team
func (*PostgresSQL) CreateToken ¶
func (c *PostgresSQL) CreateToken(userID int) (Token, error)
CreateToken creates a new token
func (*PostgresSQL) DeleteTeam ¶
func (c *PostgresSQL) DeleteTeam(teamID int) error
DeleteTeam deletes an existing team in the database
func (*PostgresSQL) DeleteToken ¶
func (c *PostgresSQL) DeleteToken(tokenID int, userID int) error
DeleteToken deletes an existing token in the database
func (*PostgresSQL) GetTeams ¶
func (c *PostgresSQL) GetTeams(teamid *int) (Teams, error)
GetTeams returns all teams from the database
func (*PostgresSQL) GetTeamsByActivation ¶
func (c *PostgresSQL) GetTeamsByActivation(activation string) (Teams, error)
GetTeamsByActivation returns all teams from the database by activation
func (*PostgresSQL) GetToken ¶
func (c *PostgresSQL) GetToken(tokenID int, userID int) (Token, error)
GetToken checks whether token exists
func (*PostgresSQL) IsConnected ¶
func (c *PostgresSQL) IsConnected() (bool, error)
IsConnected checks the connection to the database and returns an error if not connected
type Team ¶
type Team struct { ID int `db:"id" json:"id"` Name string `db:"name" json:"name"` Activation string `db:"activation" json:"activation"` Time float64 `db:"time" json:"time"` CreatedAt string `db:"created_at" json:"-"` DeletedAt sql.NullString `db:"deleted_at" json:"-"` }
type Teams ¶
type Teams []Team
Teams is a list of Team
type Token ¶
type Token struct { ID int `db:"id" json:"id"` UserID int `db:"user_id" json:"user_id"` CreatedAt string `db:"created_at" json:"-"` DeletedAt string `db:"deleted_at" json:"-"` }
Token defines a JWT in the database
Click to show internal directories.
Click to hide internal directories.