models

package
v0.0.0-...-6245078 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	gorm.Model
	LookupKey  string `gorm:"unique_index;not null"`
	IV         string `gorm:"not null"`
	CipherText string `gorm:"not null"`
}

type AuthRepo

type AuthRepo interface {
	Create(auth *Auth) error
	// Update(auth *Auth) error
	GetByLookupKey(key string) (*Auth, error)
}

type Instrument

type Instrument struct {
	Name   string  `gorm:"primary_key;auto_increment:false"`
	Tracks []Track `gorm:"many2many:tracks_instruments"`
	Users  []User  `gorm:"many2many:users_instruments"`
}

type InstrumentRepo

type InstrumentRepo interface {
	GetByName(name string) (*Instrument, error)
	Create(i *Instrument) error
	Update(i *Instrument) error
}

type Track

type Track struct {
	gorm.Model
	CID           string `gorm:"notnull"`
	Title         string
	ComposerID    uint
	Composer      User
	ParentTrackID uint
	ParentTrack   *Track

	Forks       []Track      `gorm:"foreignkey:ParentTrackID"`
	Instruments []Instrument `gorm:"many2many:tracks_instruments"`
	// contains filtered or unexported fields
}

func (*Track) AfterCreate

func (t *Track) AfterCreate(tx *gorm.DB) error

type TrackRepo

type TrackRepo interface {
	GetByTrackID(id uint) (*Track, error)
	Create(t *Track, composer *User) error
	Update(t *Track) error
	GetTracksByInstrument(instruments []string) ([]*Instrument, error)
}

type User

type User struct {
	gorm.Model
	Username      string       `gorm:"unique;not null"`
	WalletAddress string       `gorm:"unique;not null"`
	Tracks        []Track      `gorm:"foreignkey:ComposerID"`
	Instruments   []Instrument `gorm:"many2many:users_instruments"`
	DisplayName   string
}

type UserRepo

type UserRepo interface {
	Create(u *User) error
	Update(u *User) error
	UpdateInstruments(u *User) error
	GetByID(id uint) (*User, error)
	GetByUsername(username string) (*User, error)
	GetByWalletAddr(addr string) (*User, error)
}

Jump to

Keyboard shortcuts

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