Documentation ¶
Index ¶
- Constants
- func ToPrettyJSON(o interface{}) string
- type Attribute
- type AttributeCondition
- type Category
- type CategoryRule
- type DB
- func (db *DB) AddAttribute(rec, headers []string) error
- func (db *DB) AddCategoryAttribute(rec, headers []string) error
- func (db *DB) AddDynamicOption(rec, headers []string) error
- func (db *DB) AddOption(rec, headers []string) error
- func (db *DB) Attribute(id int) *Attribute
- func (db *DB) AttributeOptionPairToString(pair string) string
- func (db *DB) CategoryRule(categoryID int) *CategoryRule
- func (db *DB) ConvertID(uuid string) (id int)
- func (db *DB) ConvertItemAttributeRelationships(fromGzippedCSVFile, toCSVFile string)
- func (db *DB) Dump(o DumpOpts)
- func (db *DB) DumpCategoryRule(cr *CategoryRule, max int)
- func (db *DB) ForceAppendSuffixToAllConvertedKeys(suffix string)
- func (db *DB) FullCategoryName(categoryID int) string
- func (db *DB) ImportPostgresDatabase(a ImportPostgresDatabaseArgs) error
- func (db *DB) LoadCategoriesJSON(file string) error
- func (db *DB) Option(id int) *Option
- func (db *DB) PostProcessImportedData() error
- func (db *DB) PreSort()
- type DumpOpts
- type FindVisibleAttributesResponse
- type ImportPostgresDatabaseArgs
- type LimitedOptions
- type Option
- type OptionFilter
- type SearchConditions
- type VisibleAttribute
- type VisibleOption
Constants ¶
View Source
const (
DebugPrint = false
)
Variables ¶
This section is empty.
Functions ¶
func ToPrettyJSON ¶
func ToPrettyJSON(o interface{}) string
Types ¶
type AttributeCondition ¶
type CategoryRule ¶
type CategoryRule struct { CategoryID int ShowIfOptionIDSelected map[int][]*LimitedOptions // key = option ID (from precondition) ShowOptionIDAlways map[int]bool // key = option ID AttributeIDs []int AlwaysVisibleAttributeIDs []int }
func (*CategoryRule) AddLimitedOption ¶
func (r *CategoryRule) AddLimitedOption(selectedOptionID int, o *Option)
type DB ¶
type DB struct { IDs map[string]int `json:"ids"` IDCounter int `json:"id_counter"` Attributes map[int]*Attribute `json:"attributes"` Options map[int]*Option `json:"options"` CategoryRules map[int]*CategoryRule `json:"category_rules"` // key = category_id ReverseIDs map[int]string `json:"reverse_ids"` CategoryTree map[int]*Category `json:"category_tree"` // key = category_id // contains filtered or unexported fields }
func (*DB) AddAttribute ¶
func (*DB) AddCategoryAttribute ¶
func (*DB) AddDynamicOption ¶
func (*DB) AttributeOptionPairToString ¶
func (*DB) CategoryRule ¶
func (db *DB) CategoryRule(categoryID int) *CategoryRule
func (*DB) ConvertItemAttributeRelationships ¶
Takes a CSV file (gzipped) containing a ItemID->AttributeID->AttributeValue relationships and converts them to use this DB's IDs (integer primary keys).
func (*DB) DumpCategoryRule ¶
func (db *DB) DumpCategoryRule(cr *CategoryRule, max int)
func (*DB) ForceAppendSuffixToAllConvertedKeys ¶
func (*DB) FullCategoryName ¶
func (*DB) ImportPostgresDatabase ¶
func (db *DB) ImportPostgresDatabase(a ImportPostgresDatabaseArgs) error
Dir contains gzipped CSV of key tables from the Item Attributes database exported from Postgres (each table exported as a separate CSV file).
func (*DB) LoadCategoriesJSON ¶
func (*DB) PostProcessImportedData ¶
type FindVisibleAttributesResponse ¶
type FindVisibleAttributesResponse struct { Pages int PageSize int VAs []*VisibleAttribute Corrected *SearchConditions }
func FindVisibleAttributes ¶
func FindVisibleAttributes(sc *SearchConditions, db *DB) (res *FindVisibleAttributesResponse, err error)
type ImportPostgresDatabaseArgs ¶
type ImportPostgresDatabaseArgs struct {
Dir string
}
type LimitedOptions ¶
type OptionFilter ¶
type SearchConditions ¶
type SearchConditions struct { CategoryIDs []int `json:"category_id"` Attributes []*AttributeCondition `json:"attributes"` PageSize int `json:"page_size"` Offset int `json:"offset"` Filters []*OptionFilter `json:"filters"` }
type VisibleAttribute ¶
type VisibleAttribute struct { ID int `json:"id"` Title string `json:"title"` Os []*VisibleOption `json:"options"` }
type VisibleOption ¶
Click to show internal directories.
Click to hide internal directories.