discogs

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeArtists = iota
	ModeArtistsAliases
	ModeArtistsMemberships
	ModeLabels
	ModeMasters
	ModeMastersArtists
	ModeReleases
	ModeReleasesArtists
	ModeReleasesExtraArtists
	ModeReleasesLabels
)

Variables

View Source
var Tables = map[int]pgx.Identifier{
	ModeArtists:              pgx.Identifier{"discogs_artists"},
	ModeArtistsAliases:       pgx.Identifier{"discogs_artists_aliases"},
	ModeArtistsMemberships:   pgx.Identifier{"discogs_artists_members"},
	ModeLabels:               pgx.Identifier{"discogs_labels"},
	ModeMasters:              pgx.Identifier{"discogs_masters"},
	ModeMastersArtists:       pgx.Identifier{"discogs_master_artists"},
	ModeReleases:             pgx.Identifier{"discogs_releases"},
	ModeReleasesArtists:      pgx.Identifier{"discogs_release_artists"},
	ModeReleasesExtraArtists: pgx.Identifier{"discogs_release_extra_artists"},
	ModeReleasesLabels:       pgx.Identifier{"discogs_release_labels"},
}

Functions

This section is empty.

Types

type Artist

type Artist struct {
	// contains filtered or unexported fields
}

func (Artist) AliasesColumns

func (a Artist) AliasesColumns() []string

func (Artist) Columns

func (a Artist) Columns() []string

func (Artist) MembershipsColumns

func (a Artist) MembershipsColumns() []string

func (*Artist) ToAliasesRecords

func (a *Artist) ToAliasesRecords() [][]any

func (*Artist) ToMembershipsRecords

func (a *Artist) ToMembershipsRecords() [][]any

func (*Artist) ToRecord

func (a *Artist) ToRecord() []any

func (*Artist) UnmarshalXML added in v0.3.0

func (a *Artist) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Company

type Company struct {
	ID             int64   `xml:"id" json:"id" parquet:"id,zstd"`
	Name           string  `xml:"name" json:"name" parquet:"name,zstd"`
	EntityType     int64   `xml:"entity_type" json:"entity_type" parquet:"entity_type,zstd"`
	EntityTypeName string  `xml:"entity_type_name" json:"entity_type_name" parquet:"entity_type_name,zstd"`
	ResourceURL    string  `xml:"resource_url" json:"resource_url" parquet:"resource_url,zstd"`
	Catno          *string `xml:"catno" json:"catno" parquet:"catno,zstd"`
}

type CopyFromDump

type CopyFromDump struct {
	// contains filtered or unexported fields
}

func NewCopyFromDump

func NewCopyFromDump(filename string, mode int) (ds *CopyFromDump, err error)

NewCopyFromDump opens a Discogs dump file and returns a CopyFromDump.

func (*CopyFromDump) Close

func (ds *CopyFromDump) Close() error

func (*CopyFromDump) Columns

func (ds *CopyFromDump) Columns() []string

func (*CopyFromDump) Err

func (ds *CopyFromDump) Err() error

See pgx.CopyFromSource interface for more details.

func (*CopyFromDump) Next

func (ds *CopyFromDump) Next() bool

Next returns true if there is another row and makes the next row data available to Values(). When there are no more rows available or an error has occurred it returns false. See pgx.CopyFromSource interface for more details.

func (*CopyFromDump) Table

func (ds *CopyFromDump) Table() pgx.Identifier

Table returns the name of the table the data should be copied to.

func (*CopyFromDump) Values

func (ds *CopyFromDump) Values() (value []any, err error)

Values returns the values for the current row. See pgx.CopyFromSource interface for more details.

type CopyFromRecordChannel

type CopyFromRecordChannel struct {
	// contains filtered or unexported fields
}

CopyFromRecordChannel implements pgx.CopyFromSource for channel-based data

func NewCopyFromRecordChannel

func NewCopyFromRecordChannel(recordChan <-chan []any) *CopyFromRecordChannel

func (*CopyFromRecordChannel) Err

func (c *CopyFromRecordChannel) Err() error

func (*CopyFromRecordChannel) Next

func (c *CopyFromRecordChannel) Next() bool

func (*CopyFromRecordChannel) Values

func (c *CopyFromRecordChannel) Values() ([]any, error)

type Dump

type Dump struct {
	Decoder *xml.Decoder
	// contains filtered or unexported fields
}

Dump is a wrapper around a discogs dump file. Dump implements the io.ReadCloser interface.

func OpenDumpFile

func OpenDumpFile(filename string) (*Dump, error)

OpenDiscogsDump creates a new DiscogsDump.

func (*Dump) Close

func (dd *Dump) Close() error

Close closes the dump file.

func (*Dump) DecodeNextElement added in v0.2.0

func (dd *Dump) DecodeNextElement() (any, error)

func (*Dump) Read

func (dd *Dump) Read(p []byte) (n int, err error)

type DumpFilename

type DumpFilename string

func (DumpFilename) Gzipped

func (fn DumpFilename) Gzipped() bool

func (DumpFilename) Month

func (fn DumpFilename) Month() string

func (DumpFilename) String

func (fn DumpFilename) String() string

func (DumpFilename) Type

func (fn DumpFilename) Type() string

func (DumpFilename) Year

func (fn DumpFilename) Year() string

type ExtraArtist

type ExtraArtist struct {
	ID   int64   `xml:"id" json:"id" parquet:"id,zstd"`
	Name string  `xml:"name" json:"name" parquet:"name,zstd"`
	Anv  *string `xml:"anv" json:"name_variation" parquet:"name_variation,zstd"`
	Role *string `xml:"role" json:"role" parquet:"role,dict"`
}

type Identifier

type Identifier struct {
	Type        string  `xml:"type,attr" json:"type" parquet:"type,dict"`
	Description *string `xml:"description,attr" json:"description" parquet:"description,zstd"`
	Value       string  `xml:"value,attr" json:"value" parquet:"value,zstd"`
}

type Label

type Label struct {
	ParentLabelID *int64 `json:"parent_label_id" parquet:"parent_label_id,zstd"`
	// contains filtered or unexported fields
}

func (Label) Columns

func (l Label) Columns() []string

func (*Label) ToRecord

func (l *Label) ToRecord() []any

func (*Label) UnmarshalXML added in v0.2.0

func (l *Label) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Master

type Master struct {
	// contains filtered or unexported fields
}

func (Master) ArtistsColumns

func (m Master) ArtistsColumns() []string

func (Master) Columns

func (m Master) Columns() []string

func (*Master) ToArtistsRecords

func (m *Master) ToArtistsRecords() [][]any

func (*Master) ToRecord

func (m *Master) ToRecord() []any

func (*Master) UnmarshalXML added in v0.2.0

func (m *Master) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type MasterArtist

type MasterArtist struct {
	ID   int64   `xml:"id" json:"id" parquet:"id,zstd"`
	Name string  `xml:"name" json:"name" parquet:"name,zstd"`
	Anv  *string `xml:"anv" json:"name_variation" parquet:"name_variation,zstd"`
	Join *string `xml:"join" json:"join" parquet:"join,dict"`
}

type MultiTableXMLParser

type MultiTableXMLParser struct {
	// contains filtered or unexported fields
}

MultiTableXMLParser parses XML once and distributes records to multiple channels

func NewMultiTableXMLParser

func NewMultiTableXMLParser(filename string, channelMap map[int]chan []any, wg *sync.WaitGroup) (*MultiTableXMLParser, error)

func (*MultiTableXMLParser) Close

func (p *MultiTableXMLParser) Close() error

func (*MultiTableXMLParser) ParseAndDistribute

func (p *MultiTableXMLParser) ParseAndDistribute() error

type Name

type Name struct {
	ID   int64  `xml:"id,attr" json:"id" parquet:"id,zstd"`
	Name string `xml:",chardata" json:"name" parquet:"name,zstd"`
}

type Release

type Release struct {
	MasterID      *int64 `parquet:"master_id"`
	IsMainRelease bool   `parquet:"is_main_release,zstd"`
	// contains filtered or unexported fields
}

func (Release) ArtistsColumns

func (r Release) ArtistsColumns() []string

func (Release) Columns

func (r Release) Columns() []string

func (Release) ExtraArtistsColumns

func (r Release) ExtraArtistsColumns() []string

func (Release) LabelsColumns

func (r Release) LabelsColumns() []string

func (*Release) ToArtistsRecords

func (r *Release) ToArtistsRecords() [][]any

func (*Release) ToExtraArtistsRecords

func (r *Release) ToExtraArtistsRecords() [][]any

func (*Release) ToLabelsRecords

func (r *Release) ToLabelsRecords() [][]any

func (*Release) ToRecord

func (r *Release) ToRecord() []any

func (*Release) UnmarshalXML added in v0.2.0

func (r *Release) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type ReleaseFormat

type ReleaseFormat struct {
	Name         string   `xml:"name,attr" json:"name" parquet:"name,zstd"`
	Qty          string   `xml:"qty,attr" json:"qty" parquet:"qty,zstd"`
	Text         string   `xml:"text,attr" json:"text" parquet:"text,zstd"`
	Descriptions []string `xml:"descriptions>description" json:"descriptions" parquet:"descriptions,zstd"`
}

type ReleaseLabel

type ReleaseLabel struct {
	ID    int64   `xml:"id,attr" json:"id" parquet:"id,zstd"`
	Name  string  `xml:"name,attr" json:"name" parquet:"name,zstd"`
	Catno *string `xml:"catno,attr" json:"catno" parquet:"catno,zstd"`
}

type Serie

type Serie struct {
	ID    int64   `xml:"id,attr" json:"id" parquet:"id,zstd"`
	Name  string  `xml:"name,attr" json:"name" parquet:"name,zstd"`
	Catno *string `xml:"catno,attr" json:"catno" parquet:"catno,zstd"`
}

type SubLabel

type SubLabel struct {
	ID   int64  `xml:"id,attr" json:"id" parquet:"id,zstd"`
	Name string `xml:",chardata" json:"name" parquet:"name,zstd"`
}

type SubTrack added in v0.2.0

type SubTrack struct {
	Position     *string         `xml:"position" json:"position" parquet:"position,dict"`
	Title        string          `xml:"title" json:"title" parquet:"title,zstd"`
	Duration     *string         `xml:"duration" json:"duration" parquet:"duration,zstd"`
	Artists      []*MasterArtist `xml:"artists>artist" json:"artists" parquet:"artists"`
	ExtraArtists []*ExtraArtist  `xml:"extraartists>artist" json:"extra_artists" parquet:"extra_artists"`
}

type Track

type Track struct {
	Position     *string         `xml:"position" json:"position" parquet:"position,dict"`
	Title        string          `xml:"title" json:"title" parquet:"title,zstd"`
	Duration     *string         `xml:"duration" json:"duration" parquet:"duration,zstd"`
	Artists      []*MasterArtist `xml:"artists>artist" json:"artists" parquet:"artists"`
	ExtraArtists []*ExtraArtist  `xml:"extraartists>artist" json:"extra_artists" parquet:"extra_artists"`
	SubTracks    []*SubTrack     `xml:"sub_tracks>track" json:"sub_tracks" parquet:"sub_tracks"`
}

type Video

type Video struct {
	Src         string `xml:"src,attr" json:"src" parquet:"src,zstd"`
	Duration    int32  `xml:"duration,attr" json:"duration" parquet:"duration,zstd"`
	Embed       string `xml:"embed,attr" json:"embed" parquet:"embed,dict"`
	Title       string `xml:"title" json:"title" parquet:"title,zstd"`
	Description string `xml:"description" json:"description" parquet:"description,zstd"`
}

Jump to

Keyboard shortcuts

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