models

package
v0.0.0-...-cab0b4b Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	gorm.Model

	Name string `gorm:"not null,unique_index"`

	Cover   *Image `gorm:"ForeignKey:CoverID"`
	CoverID NullInt64

	Year NullInt64

	Songs []*Song `gorm:"ForeignKey:AlbumID"`
}

Album model.

type Artist

type Artist struct {
	gorm.Model

	Name  string `gorm:"not null,unique_index"`
	Songs []*Song
}

Artist model.

type Image

type Image struct {
	gorm.Model

	Path string `gorm:"not null; unique"`
	Link string `gorm:"not null; unique"`
	Mime string `gorm:"not null"`
	Hash string `gorm:"not null; unique"`
}

Image model.

type NullFloat64

type NullFloat64 struct {
	sql.NullFloat64
}

func (NullFloat64) MarshalJSON

func (v NullFloat64) MarshalJSON() ([]byte, error)

func (*NullFloat64) Set

func (v *NullFloat64) Set(data float64)

func (*NullFloat64) UnmarshalJSON

func (v *NullFloat64) UnmarshalJSON(data []byte) error

type NullInt64

type NullInt64 struct {
	sql.NullInt64
}

func (NullInt64) MarshalJSON

func (v NullInt64) MarshalJSON() ([]byte, error)

func (*NullInt64) Set

func (v *NullInt64) Set(data int64)

func (*NullInt64) UnmarshalJSON

func (v *NullInt64) UnmarshalJSON(data []byte) error

type NullString

type NullString struct {
	sql.NullString
}

func (NullString) MarshalJSON

func (v NullString) MarshalJSON() ([]byte, error)

func (*NullString) Set

func (v *NullString) Set(data string)

func (*NullString) UnmarshalJSON

func (v *NullString) UnmarshalJSON(data []byte) error

type Playlist

type Playlist struct {
	gorm.Model

	Name  string  `gorm:"not null,unique_index"`
	Songs []*Song `gorm:"many2many:playlist_songs"`
}

Playlist model.

type Song

type Song struct {
	gorm.Model

	Name string `gorm:"not null"`

	Artist   *Artist `gorm:"ForeignKey:ArtistID"`
	ArtistID NullInt64

	Album   *Album `gorm:"ForeignKey:AlbumID"`
	AlbumID NullInt64

	Cover   *Image `gorm:"ForeignKey:CoverID"`
	CoverID NullInt64

	Year        NullInt64
	Track       NullInt64
	TotalTracks NullInt64

	Genre    NullString
	Duration NullFloat64
	Mime     string `gorm:"not null"`
	Path     string `gorm:"not null"`
	Played   uint   `gorm:"not null"`
}

Song model.

type User

type User struct {
	gorm.Model

	Username string `gorm:"unique_index"`
	Password string `gorm:"not null"`
}

User model.

Jump to

Keyboard shortcuts

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