database

package
v0.0.0-...-60084ce Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func CloseDatabase

func CloseDatabase()

func InitializeDatabase

func InitializeDatabase(configuration configuration.Configuration)

Types

type BaseModel

type BaseModel struct {
	ID uuid.UUID `gorm:"type:uuid;primary_key;"`
}

func (*BaseModel) BeforeCreate

func (base *BaseModel) BeforeCreate(scope *gorm.Scope) error

type Folder

type Folder struct {
	BaseModel
	Owner        uuid.UUID
	Name         string
	ParentFolder *uuid.UUID `gorm:"column:parentFolder"`
	CreatedAt    time.Time  `gorm:"column:createdAt"`
}

type Playlist

type Playlist struct {
	BaseModel
	Owner        uuid.UUID
	Name         string
	ParentFolder *uuid.UUID `gorm:"column:parentFolder"`
	CreatedAt    time.Time  `gorm:"column:createdAt"`
}

type PlaylistSong

type PlaylistSong struct {
	PlaylistId uuid.UUID `gorm:"column:playlistId"`
	SongId     uuid.UUID `gorm:"column:songId"`
}

type Song

type Song struct {
	BaseModel
	Owner      uuid.UUID
	Title      string
	Duration   int
	AudioFile  *uuid.UUID `gorm:"column:audioFile"`
	CoverFiler *uuid.UUID `gorm:"column:coverFile"`
}

type User

type User struct {
	BaseModel
	Username       string
	Email          string
	Password       string
	Activated      sql.NullBool
	ActivationCode string    `gorm:"column:activationCode"`
	CreatedAt      time.Time `gorm:"column:createdAt"`

	Playlists []Playlist `gorm:"foreignkey:Owner"`
}

Jump to

Keyboard shortcuts

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