batch

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewWriter = newWriter
View Source
var ProjectRootPattern = regexp.MustCompile("^(.*go-discogs).*")

Functions

func ExtractClause

func ExtractClause(i interface{}) clause.OnConflict

func GetProjectRoot added in v1.1.0

func GetProjectRoot() string

func GetScriptFolderName added in v1.1.0

func GetScriptFolderName() string

func GetScriptPath added in v1.1.0

func GetScriptPath() string

func InsertMasterRelations

func InsertMasterRelations(order Order) result.Result

func InsertSimple

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

func ReadScript added in v1.1.0

func ReadScript() (string, error)

func RunDDL added in v1.1.0

func RunDDL(db *gorm.DB) error

func Transform

func Transform(item rxgo.Item) rxgo.Observable

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 Runner added in v1.1.0

type Runner struct{}

func (*Runner) Run added in v1.1.0

func (*Runner) Run(ctx context.Context, config *koanf.Koanf) error

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 sugar, 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 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"`
	Title       *string    `xml:"title"`
	DataQuality *string    `xml:"data_quality"`
	Year        *int16     `xml:"year"`
	Styles      []string   `xml:"styles>style"`
	Genres      []string   `xml:"genres>genre"`
	Artists     []int32    `xml:"artists>artist>id"`
	Videos      []XmlVideo `xml:"videos>video"`
}

func (*XmlMasterRelation) GetGenres added in v1.1.0

func (m *XmlMasterRelation) GetGenres() []*model.Genre

func (*XmlMasterRelation) GetMaster added in v1.1.0

func (m *XmlMasterRelation) GetMaster() *model.Master

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

func (*XmlMasterRelation) GetStyles added in v1.1.0

func (m *XmlMasterRelation) GetStyles() []*model.Style

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"`
	MasterInfo        XmlReleaseMasterInfo `xml:"master_id"`
	Status            *string              `xml:"status,attr"`
}

func (*XmlRelease) Transform

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

type XmlReleaseMasterInfo added in v1.1.0

type XmlReleaseMasterInfo struct {
	MasterID *int32 `xml:",cdata"`
	IsMaster bool   `xml:"is_main_release,attr"`
}

type XmlReleaseRelation

type XmlReleaseRelation 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"`
	MasterInfo        XmlReleaseMasterInfo `xml:"master_id"`
	Status            *string              `xml:"status,attr"`
	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) GetGenres added in v1.1.0

func (r *XmlReleaseRelation) GetGenres() []*model.Genre

func (*XmlReleaseRelation) GetIdentifiers

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

func (*XmlReleaseRelation) GetLabels

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

func (*XmlReleaseRelation) GetRelease added in v1.1.0

func (r *XmlReleaseRelation) GetRelease() *model.Release

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) GetStyles added in v1.1.0

func (r *XmlReleaseRelation) GetStyles() []*model.Style

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