models

package
v0.2.0-beta Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2016 License: MIT Imports: 6 Imported by: 4

Documentation

Index

Constants

View Source
const (
	PermissionBanned = 1 << iota
	PermissionModerator
	PermissionAdmin
)

User Permissions

Variables

This section is empty.

Functions

func CreateDB

func CreateDB() (gorm.DB, error)

CreateDB creates an instance of a Gorm database.

func Migrate

func Migrate(db gorm.DB) error

Migrate automatically migrates the passed database to the latest version.

Types

type DBVer

type DBVer struct {
	ID      int
	Version uint64 // as it's a UNIX timestamp, we need to take something high.
}

DBVer is a struct which only scope is to help manage migrations.

type User

type User struct {
	ID          int
	Username    string `sql:"size:20"`
	Permissions uint32
	Email       string
	Password    string
}

User is an user on bancho.

func (User) GetColour

func (u User) GetColour() byte

GetColour gets an user's colour in the chat.

func (User) IsAdmin

func (u User) IsAdmin() bool

IsAdmin tells whether a user is an admin.

func (User) IsBanned

func (u User) IsBanned() bool

IsBanned tells whether a user is banned.

func (User) IsModerator

func (u User) IsModerator() bool

IsModerator tells whether a user is a moderator.

type UserFriendship

type UserFriendship struct {
	ID int
	// Don't ask me on what kind of drugs I was on when I decided they had to be lovers.
	// Because I have no idea.
	// Heroin, perhaps?
	Lover int
	Loved int
}

UserFriendship is a friendship relationship between two users.

Jump to

Keyboard shortcuts

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