batch

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// StyleCache stores name and id in form of string and int32
	StyleCache = &sync.Map{}
	// GenreCache stores name and id in form of string and int32
	GenreCache = &sync.Map{}
	// ArtistIDCache stores id in form of int32, struct{}
	ArtistIDCache = &sync.Map{}
	// LabelIDCache stores id in form of int32, struct{}
	LabelIDCache = &sync.Map{}
	// MasterIDCache stores id in form of int32, struct{}
	MasterIDCache = &sync.Map{}
)
View Source
var NewWriter = newWriter

Functions

func ExtractClause

func ExtractClause(i interface{}) clause.OnConflict

func InsertMaster

func InsertMaster(order Order) result.Result

func InsertMasterRelations

func InsertMasterRelations(order Order) result.Result

func InsertSimple

func InsertSimple[F, T any](order Order, topic string, localName string) result.Result

func Transform

func Transform(item rxgo.Item) rxgo.Observable

func UpdateGenreStyle

func UpdateGenreStyle(order Order, localName string) result.Result

func WriteMasterRelations

func WriteMasterRelations(order Order, res chan result.Result, wg *sync.WaitGroup) func(i interface{})

Types

type Batch

type Batch interface {
	UpdateArtist(order Order) Step
	UpdateLabel(order Order) Step
	UpdateMaster(order Order) Step
	UpdateRelease(order Order) Step
}

func New

func New() Batch

type Order

type Order interface {
	// contains filtered or unexported methods
}

func NewOrder

func NewOrder(ctx context.Context, chunkSize int, filepath string, db *gorm.DB) Order

type Step

type Step func() result.Result

func GetArtistStep

func GetArtistStep(order Order) Step

func GetLabelStep

func GetLabelStep(order Order) Step

func GetMasterStep

func GetMasterStep(order Order) Step

func GetReleaseStep

func GetReleaseStep(order Order) Step

GetReleaseStep returns a set of steps in a form of composite notary. This is a convenient func such that reduces code and adds syntactic suger, but nothing more.

type Transformable

type Transformable interface {
	Transform() rxgo.Observable
}

type Writer

type Writer interface {
	Write(chunkSize int, items ...interface{}) result.Result
}

type XmlArtist

type XmlArtist struct {
	ID          int32   `xml:"id"`
	Name        *string `xml:"name"`
	DataQuality *string `xml:"data_quality"`
	Profile     *string `xml:"profile"`
	RealName    *string `xml:"realname"`
}

func (*XmlArtist) Transform

func (a *XmlArtist) Transform() rxgo.Observable

type XmlArtistRelation

type XmlArtistRelation struct {
	ID       int32    `xml:"id" gorm:"column:id"`
	Urls     []string `xml:"urls>url"`
	NameVars []string `xml:"namevariations>name"`
	Aliases  []XmlRef `xml:"aliases>name"`
	Groups   []XmlRef `xml:"groups>name"`
}

func (*XmlArtistRelation) GetAliases

func (a *XmlArtistRelation) GetAliases() []*model.ArtistAlias

func (*XmlArtistRelation) GetGroups

func (a *XmlArtistRelation) GetGroups() []*model.ArtistGroup

func (*XmlArtistRelation) GetNameVars

func (a *XmlArtistRelation) GetNameVars() []*model.ArtistNameVariation

func (*XmlArtistRelation) GetUrls

func (a *XmlArtistRelation) GetUrls() []*model.ArtistURL

type XmlContract

type XmlContract struct {
	ResourceUrl string `xml:"resource_url"`
	Content     string `xml:"entity_type_name"`
}

type XmlCreditedArtist

type XmlCreditedArtist struct {
	ArtistID int32  `xml:"id"`
	Role     string `xml:"role"`
}

type XmlFormat

type XmlFormat struct {
	Name         *string  `xml:"name,attr"`
	Quantity     *int32   `xml:"qty,attr"`
	Text         *string  `xml:"text,attr"`
	Descriptions []string `xml:"descriptions>description"`
}

type XmlGenreStyle

type XmlGenreStyle struct {
	Styles []string `xml:"styles>style"`
	Genres []string `xml:"genres>genre"`
}

type XmlIdentifier

type XmlIdentifier struct {
	Typ   string `xml:"type,attr"`
	Desc  string `xml:"description,attr"`
	Value string `xml:"value,attr"`
}

type XmlIsMaster

type XmlIsMaster struct {
	IsMaster bool `xml:"is_main_release,attr"`
}

type XmlLabel

type XmlLabel struct {
	ID          int32   `xml:"id"`
	Name        *string `xml:"name"`
	ContactInfo *string `xml:"contactinfo"`
	Profile     *string `xml:"profile"`
	DataQuality *string `xml:"data_quality"`
}

func (*XmlLabel) Transform

func (l *XmlLabel) Transform() rxgo.Observable

type XmlLabelRelation

type XmlLabelRelation struct {
	ID          int32    `xml:"id"`
	Urls        []string `xml:"urls>url"`
	ParentLabel *XmlRef  `xml:"parentLabel"`
}

func (*XmlLabelRelation) GetParentID

func (l *XmlLabelRelation) GetParentID() *int32

func (*XmlLabelRelation) GetUrls

func (l *XmlLabelRelation) GetUrls() []*model.LabelURL

type XmlLabelRelease

type XmlLabelRelease struct {
	LabelID          int32  `xml:"id,attr"`
	CategoryNotation string `xml:"catno,attr"`
}

type XmlMaster

type XmlMaster struct {
	ID          int32   `xml:"id,attr"`
	Title       *string `xml:"title"`
	DataQuality *string `xml:"data_quality"`
	Year        *int16  `xml:"year"`
}

func (*XmlMaster) Transform

func (m *XmlMaster) Transform() rxgo.Observable

type XmlMasterRelation

type XmlMasterRelation struct {
	ID      int32      `xml:"id,attr"`
	Styles  []string   `xml:"styles>style"`
	Genres  []string   `xml:"genres>genre"`
	Artists []int32    `xml:"artists>artist>id"`
	Videos  []XmlVideo `xml:"videos>video"`
}

func (*XmlMasterRelation) GetMasterArtists

func (m *XmlMasterRelation) GetMasterArtists() []*model.MasterArtist

func (*XmlMasterRelation) GetMasterGenres

func (m *XmlMasterRelation) GetMasterGenres() []*model.MasterGenre

func (*XmlMasterRelation) GetMasterStyles

func (m *XmlMasterRelation) GetMasterStyles() []*model.MasterStyle

func (*XmlMasterRelation) GetMasterVideos

func (m *XmlMasterRelation) GetMasterVideos() []*model.MasterVideo

type XmlRef

type XmlRef struct {
	ID   int32  `xml:"id,attr"`
	Name string `xml:",chardata"`
}

type XmlRelease

type XmlRelease struct {
	ID                int32       `xml:"id,attr"`
	Title             *string     `xml:"title"`
	Country           *string     `xml:"country"`
	DataQuality       *string     `xml:"data_quality"`
	ListedReleaseDate *string     `xml:"released"`
	Notes             *string     `xml:"notes"`
	IsMaster          XmlIsMaster `xml:"master_id"`
	Status            *string     `xml:"status,attr"`
}

func (*XmlRelease) Transform

func (m *XmlRelease) Transform() rxgo.Observable

type XmlReleaseRelation

type XmlReleaseRelation struct {
	ID              int32               `xml:"id,attr"`
	MasterID        int32               `xml:"master_id"`
	Artists         []int32             `xml:"artists>artist>id"`
	Labels          []XmlLabelRelease   `xml:"labels>label"`
	CreditedArtists []XmlCreditedArtist `xml:"extraartists>artist"`
	Formats         []XmlFormat         `xml:"formats>format"`
	Genres          []string            `xml:"genres>genre"`
	Styles          []string            `xml:"styles>style"`
	Tracks          []XmlTrack          `xml:"tracklist>track"`
	Identifiers     []XmlIdentifier     `xml:"identifiers>identifier"`
	Videos          []XmlVideo          `xml:"videos>video"`
	Contracts       []XmlContract       `xml:"companies>company"`
}

func (*XmlReleaseRelation) GetContracts

func (r *XmlReleaseRelation) GetContracts() []*model.ReleaseContract

func (*XmlReleaseRelation) GetCreditedArtists

func (r *XmlReleaseRelation) GetCreditedArtists() []*model.ReleaseCreditedArtist

func (*XmlReleaseRelation) GetFormats

func (r *XmlReleaseRelation) GetFormats() []*model.ReleaseFormat

func (*XmlReleaseRelation) GetIdentifiers

func (r *XmlReleaseRelation) GetIdentifiers() []*model.ReleaseIdentifier

func (*XmlReleaseRelation) GetLabels

func (r *XmlReleaseRelation) GetLabels() []*model.LabelRelease

func (*XmlReleaseRelation) GetMasterReleases

func (r *XmlReleaseRelation) GetMasterReleases() []*model.MasterMainRelease

func (*XmlReleaseRelation) GetReleaseArtists

func (r *XmlReleaseRelation) GetReleaseArtists() []*model.ReleaseArtist

func (*XmlReleaseRelation) GetReleaseGenres

func (r *XmlReleaseRelation) GetReleaseGenres() []*model.ReleaseGenre

func (*XmlReleaseRelation) GetReleaseStyles

func (r *XmlReleaseRelation) GetReleaseStyles() []*model.ReleaseStyle

func (*XmlReleaseRelation) GetTracks

func (r *XmlReleaseRelation) GetTracks() []*model.ReleaseTrack

func (*XmlReleaseRelation) GetVideos

func (r *XmlReleaseRelation) GetVideos() []*model.ReleaseVideo

type XmlTrack

type XmlTrack struct {
	Position string `xml:"position"`
	Title    string `xml:"title"`
	Duration string `xml:"duration"`
}

type XmlVideo

type XmlVideo struct {
	URL         string  `xml:"src,attr"`
	Title       *string `xml:"title"`
	Description *string `xml:"description"`
}

Jump to

Keyboard shortcuts

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