database

package
v0.0.0-...-86e536e Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2018 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Competition

type Competition struct {
	ID           int64     `db:"ID"`
	Name         string    `db:"NAME"`
	EventDate    time.Time `db:"EVENT_DATE"`
	RangeID      int64     `db:"RANGE_ID"`
	CategoryID   int64     `db:"CATEGORY_ID"`
	TypeID       int64     `db:"TYPE_ID"`
	Active       bool      `db:"ACTIVE"`
	Created      time.Time `db:"CREATED_TS"`
	CategoryCode string    `db:"CATEGORY_CODE"`
	CategoryName string    `db:"CATEGORY_NAME"`
	TypeCode     string    `db:"TYPE_CODE"`
	TypeName     string    `db:"TYPE_NAME"`
	RangeName    string    `db:"RANGE_NAME"`
}

type Database

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

Database is wrapper around database connection

func NewDatabase

func NewDatabase(db *sql.DB, driverName string) *Database

func NewMysqlDatabase

func NewMysqlDatabase() (*Database, error)

func (*Database) GetCompetitionByID

func (db *Database) GetCompetitionByID(id int64) (*Competition, error)

func (*Database) GetCompetitions

func (db *Database) GetCompetitions(rangeID int64, activeOnly bool) ([]Competition, error)

func (*Database) GetRangeByID

func (db *Database) GetRangeByID(id int64) (*Range, error)

func (*Database) GetRanges

func (db *Database) GetRanges(activeOnly bool) ([]Range, error)

func (*Database) GetUserByID

func (db *Database) GetUserByID(id int64) (*User, error)

func (*Database) GetUserByLogin

func (db *Database) GetUserByLogin(login string, activeOly bool) (*User, error)

func (*Database) InvalidateToken

func (db *Database) InvalidateToken(login, token string, validTo time.Time) error

func (*Database) IsTokenInvalid

func (db *Database) IsTokenInvalid(login, token string) bool

type InvalidToken

type InvalidToken struct {
	ID      int64     `db:"ID"`
	UserId  string    `db:"USER_ID"`
	Token   string    `db:"TOKEN"`
	ValidTo time.Time `db:"VALID_TO"`
}

type Range

type Range struct {
	ID        int64     `db:"ID"`
	Name      string    `db:"NAME"`
	Latitude  float64   `db:"LATITUDE"`
	Longitude float64   `db:"LONGITUDE"`
	URL       string    `db:"URL"`
	Active    bool      `db:"ACTIVE"`
	Created   time.Time `db:"CREATED_TS"`
}

Range represents records in ranges table

type User

type User struct {
	ID             int64     `db:"ID"`
	Login          string    `db:"LOGIN"`
	Password       string    `db:"PASSWORD"`
	RoleCompetitor bool      `db:"ROLE_COMPETITOR"`
	RoleJudge      bool      `db:"ROLE_JUDGE"`
	RoleDirector   bool      `db:"ROLE_DIRECTOR"`
	RoleAdmin      bool      `db:"ROLE_ADMIN"`
	Active         bool      `db:"ACTIVE"`
	Created        time.Time `db:"CREATED_TS"`
}

User represents records in users table

Jump to

Keyboard shortcuts

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