models

package
v0.0.0-...-6cdaf0f Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	ID        uint       `gorm:"primary_key" json:"id,omitempty"`
	CreatedAt time.Time  `gorm:"not null" json:"created_at" sql:"DEFAULT:CURRENT_TIMESTAMP"`
	UpdatedAt time.Time  `gorm:"not null" json:"updated_at" sql:"DEFAULT:CURRENT_TIMESTAMP"`
	DeletedAt *time.Time `sql:"index" json:"deleted_at,omitempty"`
}

type Playlist

type Playlist struct {
	Tracklist []Track
}

func (*Playlist) GenerateRandomTracks

func (p *Playlist) GenerateRandomTracks()

func (*Playlist) GetRandomTrack

func (p *Playlist) GetRandomTrack() Track

type Track

type Track struct {
	Model
	Artist  string `gorm:"type:varchar(50)" json:"artist" validate:"required"`
	Name    string `gorm:"type:varchar(50)" json:"name" validate:"required"`
	Length  int64  `gorm:"type:int(4)" json:"length" validate:"required"`
	Label   string `gorm:"type:varchar(50)" json:"label"`
	Genre   string `gorm:"type:varchar(50)" json:"genre"`
	Album   string `gorm:"type:varchar(100)" json:"album"`
	Year    string `gorm:"type:int(4)" json:"year" validate:"required,year"`
	MP3File string `gorm:"type:varchar(256)" json:"mp3file"`
	Cover   string `gorm:"type:varchar(256)" json:"cover"`
}

func (*Track) Delete

func (t *Track) Delete()

func (*Track) GetLength

func (t *Track) GetLength() (int64, error)

func (*Track) SetCover

func (t *Track) SetCover()

func (*Track) SetFieldsWithID3Tags

func (t *Track) SetFieldsWithID3Tags() *Track

func (*Track) TableName

func (t *Track) TableName() string

type Tracks

type Tracks struct {
	Playlist []Track
}

Jump to

Keyboard shortcuts

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