models

package
v0.0.0-...-1af73ce Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: GPL-3.0 Imports: 5 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	gorm.Model
	Name             string `json:"name" gorm:"unique;not null"`
	Password         string `json:"-"`
	IsPassword       bool   `json:"isPassword"`
	User             *User  `json:"user"`
	UserID           uint   `json:"userId" gorm:"not null"`
	Description      string `json:"description"`
	AccessToken      string `json:"accessToken" gorm:"unique;not null"`
	GuestAccessToken string `json:"guestAccessToken" gorm:"unique;not null"`
}

Application is struct of application

func (*Application) Create

func (a *Application) Create() (err error)

Create creates an application

func (*Application) Delete

func (a *Application) Delete() (err error)

Delete deletes an application

func (*Application) FindByAccessToken

func (a *Application) FindByAccessToken(accessToken string) (err error)

FindByAccessToken finds an application by access token

func (*Application) FindByGuestAccessToken

func (a *Application) FindByGuestAccessToken(guestAccessToken string) (err error)

FindByGuestAccessToken finds an application by guest access token

func (*Application) FindByID

func (a *Application) FindByID(id uint) (err error)

FindByID finds an application by id

func (*Application) Update

func (a *Application) Update() (err error)

Update updates an application

type Applications

type Applications []Application

Applications is slice of applications

func (*Applications) FindByUserID

func (as *Applications) FindByUserID(userID uint, offset, limit int) (err error)

FindByUserID finds applications by user id

func (*Applications) List

func (as *Applications) List(offset, limit int) (err error)

List lists applications

func (*Applications) SearchByName

func (as *Applications) SearchByName(name string, offset, limit int) (err error)

SearchByName searches applications by name

type Sound

type Sound struct {
	gorm.Model
	Name     string `json:"name" gorm:"unique;not null;index"`
	Path     string `json:"path" gorm:"unique;not null"`
	NumCalls int    `json:"numCalls" gorm:"default 0"`
}

Sound is struct of Sound

func (*Sound) Count

func (s *Sound) Count() (count int, err error)

Count returns the number of Sounds

func (*Sound) FindByName

func (s *Sound) FindByName(name string) (err error)

FindByName finds a sound by name

func (*Sound) Update

func (s *Sound) Update() (err error)

Update update sound

type Sounds

type Sounds []Sound

Sounds is slice of sounds

func (*Sounds) List

func (ss *Sounds) List(offset, limit int) (err error)

List lists sounds

func (*Sounds) SearchByName

func (ss *Sounds) SearchByName(name string, offset, limit int) (err error)

SearchByName searches a sound by name

type User

type User struct {
	gorm.Model
	UID          string        `json:"uid" gorm:"unique;not null"`
	Name         string        `json:"name" gorm:"unique;not null"`
	Applications []Application `json:"applications"`
	Description  string        `json:"description"`
}

User is struct of user

func (*User) Create

func (u *User) Create() (err error)

Create creates a user

func (*User) Delete

func (u *User) Delete() (err error)

Delete deletes a user

func (*User) FindByID

func (u *User) FindByID(id uint) (err error)

FindByID finds a user by id

func (*User) FindByName

func (u *User) FindByName(name string) (err error)

FindByName finds a user by name

func (*User) FindByUID

func (u *User) FindByUID(uid string) (err error)

FindByUID finds a user by uid

func (*User) GenerateAccessToken

func (u *User) GenerateAccessToken() (token string, err error)

GenerateAccessToken generates access token from user

func (*User) Update

func (u *User) Update() (err error)

Update updates user

type Users

type Users []User

Users is slice of users

Jump to

Keyboard shortcuts

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