vitrex_csv_parser

package module
v0.0.0-...-cfaf96b Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

README

API reference

Vitrex CSV Parser

This package parses the CSV file from Vitrex

License

This package is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Documentation

Overview

Copyright © 2020 Darko Luketic <info@icod.de>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2020 Darko Luketic <info@icod.de>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2020 Darko Luketic <info@icod.de>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2020 Darko Luketic <info@icod.de>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Product

type Product struct {
	ProductNumber    string    `bson:"product_number" json:"product_number"`
	Title            string    `bson:"title" json:"title"`
	EAN              string    `bson:"ean" json:"ean"`
	ReleaseDate      time.Time `bson:"release_date" json:"release_date"`
	Supplier         string    `bson:"supplier" json:"supplier"`
	ProductGroup     string    `bson:"product_group" json:"product_group"`
	Genre            string    `bson:"genre" json:"genre"`
	USK              string    `bson:"usk" json:"usk"`
	Rating           string    `bson:"rating" json:"rating"`
	Price            float64   `bson:"price" json:"price"`
	RecommendedPrice float64   `bson:"recommended_price" json:"recommended_price"`
}

func DownloadAndParse

func DownloadAndParse(url string) ([]*Product, error)

DownloadAndParse is a convenience function that downloads the Preisliste.csv from an URL and returns a slice of *Product

func FilterByGenre

func FilterByGenre(value string, products []*Product) []*Product

FilterByGenre is a convenience function that filters products by genre

func FilterByProductGroup

func FilterByProductGroup(value string, products []*Product) []*Product

FilterByProductGroup is a convenience function that filters products by product group

func FilterBySupplier

func FilterBySupplier(value string, products []*Product) []*Product

FilterBySupplier is a convenience function that filters products by supplier

func FilterByUSK

func FilterByUSK(value string, products []*Product) []*Product

FilterByUSK is a convenience function that filters products by USK

func Parse

func Parse(reader io.Reader) ([]*Product, error)

Parse parses a Vitrex csv file and requires an io.Reader to be passed

func ParseFile

func ParseFile(path string) ([]*Product, error)

ParseFile is a convenience function that loads a Preisliste.csv from the file system and returns a slice of *Products. In the event of an error nil is returned for the []*Product

Jump to

Keyboard shortcuts

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