models

package
v0.0.0-...-5e6a799 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2020 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccumData

type AccumData struct {
	Date  string `db:"accum_date" json:"date"`
	Count uint   `db:"count" json:"count"`
	Accum uint   `db:"accum" json:"accum"`
}

type AnalyticsData

type AnalyticsData struct {
	PlayCount  uint        `json:"playcount"`
	UserCount  uint        `json:"usercount"`
	MCVersion  string      `json:"mcversion"`
	ModVersion string      `json:"modversion"`
	Users      []AccumData `json:"user"`
}

type Database

type Database interface {
	PutMessage(m *Message) error
	FindUsers(where UserWhere, offset uint, limit uint) (user []User, err error)
	CountUniqueUser(where UserWhere) (count uint, err error)
	SumPlayCount() (count uint, err error)
	GetUserData(id string) (userdata UserData, err error)
	GetPlayCount() (c uint, err error)
	GetUserCount() (c uint, err error)
	GetMostPlayedMCVersion() (v string, err error)
	GetMostPlayedModVersion() (v string, err error)
	GetAnalyticsData() (d AnalyticsData, err error)
	GetUserTransition() (d []AccumData, err error)
}

type Message

type Message struct {
	UUID            string `json:"uuid" query:"id" validate:"required,mcuuid"`
	UserName        string `json:"username" query:"name" validate:"required"`
	IP              string `json:"ip"`
	VersionMod      string `json:"version_mod" query:"vmod" validate:"required" json:"-"`
	VersionModMC    string `json:"version_mod_mc" query:"vmodmc" validate:"required" json:"-"`
	VersionModForge string `json:"version_mod_forge" query:"vmodforge" validate:"required" json:"-"`
	VersionMC       string `json:"version_mc" query:"vmc" validate:"required" json:"-"`
	VersionForge    string `json:"version_forge" query:"vforge" validate:"required" json:"-"`
	Message         string `json:"message"`
	CreatedAt       string `json:"created_at"`
	UpdatedAt       string `json:"updated_at"`
	UpdatedCount    uint   `json:"updated_count"`
}

type Model

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

func NewModel

func NewModel(db *sqlx.DB) *Model

func (*Model) CountUniqueUser

func (u *Model) CountUniqueUser(where UserWhere) (count uint, err error)

func (*Model) FindUsers

func (u *Model) FindUsers(where UserWhere, offset uint, limit uint) (user []User, err error)

func (*Model) GetAnalyticsData

func (m *Model) GetAnalyticsData() (d AnalyticsData, err error)

func (*Model) GetMostPlayedMCVersion

func (m *Model) GetMostPlayedMCVersion() (v string, err error)

func (*Model) GetMostPlayedModVersion

func (m *Model) GetMostPlayedModVersion() (v string, err error)

func (*Model) GetPlayCount

func (m *Model) GetPlayCount() (c uint, err error)

func (*Model) GetUserCount

func (m *Model) GetUserCount() (c uint, err error)

func (*Model) GetUserData

func (m *Model) GetUserData(id string) (userdata UserData, err error)

func (*Model) GetUserTransition

func (m *Model) GetUserTransition() (d []AccumData, err error)

func (*Model) PutMessage

func (m *Model) PutMessage(msg *Message) error

func (*Model) SumPlayCount

func (u *Model) SumPlayCount() (count uint, err error)

type User

type User struct {
	UUID         string `json:"uuid" db:"uuid"`
	UserName     string `json:"username" db:"username"`
	IP           string `json:"-" db:"ip"`
	Message      string `json:"message" db:"message"`
	CreatedAt    string `json:"created_at" db:"created_at"`
	UpdatedAt    string `json:"updated_at" db:"updated_at"`
	UpdatedCount uint   `json:"updated_count" db:"updated_count"`
}

type UserData

type UserData struct {
	User        *User          `json:"user"`
	UserVersion *[]UserVersion `json:"user_version"`
}

type UserVersion

type UserVersion struct {
	UUID            string `json:"-" db:"uuid"`
	VersionMod      string `json:"version_mod" db:"version_mod"`
	VersiomModMC    string `json:"version_mod_mc" db:"version_mod_mc"`
	VersionModForge string `json:"version_mod_forge" db:"version_mod_forge"`
	VersionMC       string `json:"version_mc" db:"version_mc"`
	VersionForge    string `json:"version_forge" db:"version_forge"`
	CreatedAt       string `json:"created_at" db:"created_at"`
	UpdatedAt       string `json:"updated_at" db:"updated_at"`
	UpdatedCount    string `json:"updated_count" db:"updated_count"`
}

type UserWhere

type UserWhere struct {
	UUID     string `db:"uuid" query:"id" validate:"omitempty,mcuuid" operator:"="`
	UserName string `db:"username" query:"name" operator:"="`
	IP       string `db:"ip" query:"ip" validate:"omitempty,ip" operator:"="`
}

Jump to

Keyboard shortcuts

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