sheetsmap

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2022 License: MIT Imports: 7 Imported by: 0

README

SheetsMap for Google

Example Schema:

  1. email
  2. name
  3. tshirt size|t-shirt size - Size - extra small|XS, small|S,medium|M, large|L, extra large|XL, double extra large|XXL, triple extra large|XXXL - more info: size charts|http://www.sizecharter.com/brands/americapparel/mens
  4. tshirt gender|t-shirt gender - Gender - male|m, female|f

Documentation

Index

Constants

View Source
const (
	ErrorColumnNotFound = "ErrorColumnNotFound"
	ErrorEnumNotMatched = "ErrorEnumNotMatched"
)

Variables

This section is empty.

Functions

func TrimSpaceToLower

func TrimSpaceToLower(s string) string

Types

type Column

type Column struct {
	Name               string
	NameAliases        []string
	Abbreviation       string
	Index              uint64
	Enums              []Enum
	AliasLcToCanonical map[string]string
	InfoURLs           []InfoURL
}

func NewColumn

func NewColumn() Column

func ParseColumn

func ParseColumn(input string) (Column, error)

ParseColumn tshirt size - XS, S, M, L, XL, XXL, XXXL colName | colAbbr | Enums | URLs

func (*Column) AddEnum

func (col *Column) AddEnum(enum Enum)

func (*Column) EnumsCanonical

func (col *Column) EnumsCanonical() []string

func (*Column) EnumsStrings

func (col *Column) EnumsStrings() []string

func (*Column) ValueToCanonical

func (col *Column) ValueToCanonical(val string) (string, error)

type Enum

type Enum struct {
	Canonical string
	Aliases   []string
}

func (*Enum) Values

func (enum *Enum) Values() []string

type InfoURL

type InfoURL struct {
	Text string
	URL  string
}

type Intent

type Intent struct {
	Name  string
	Slots map[string]string
}

type Item

type Item struct {
	Key     string
	Display string
	Row     uint
	Data    map[string]string
}

func (*Item) ItemDisplayOrKey

func (item *Item) ItemDisplayOrKey() string

type SheetsMap

type SheetsMap struct {
	GoogleClient *http.Client
	Service      *spreadsheet.Service

	Spreadsheet spreadsheet.Spreadsheet
	Sheet       *spreadsheet.Sheet

	KeyColumnIndex uint
	Columns        []Column
	ColumnMapKeyLc map[string]Column
	ItemMap        map[string]Item
	// contains filtered or unexported fields
}

func NewSheetsMap

func NewSheetsMap() SheetsMap

func NewSheetsMapIndex

func NewSheetsMapIndex(googleClient *http.Client, spreadsheetID string, sheetIndex uint) (SheetsMap, error)

func NewSheetsMapTitle

func NewSheetsMapTitle(googleClient *http.Client, spreadsheetId string, sheetTitle string) (SheetsMap, error)

func (*SheetsMap) ColumnsKeys

func (sm *SheetsMap) ColumnsKeys() []string

func (*SheetsMap) CombinedStatsCol0Enum

func (sm *SheetsMap) CombinedStatsCol0Enum() ([]Stat, error)

func (*SheetsMap) DataColumnsKeys

func (sm *SheetsMap) DataColumnsKeys() []string

func (*SheetsMap) EmptyCols

func (sm *SheetsMap) EmptyCols(item Item) []string

func (*SheetsMap) FullRead

func (sm *SheetsMap) FullRead() error

func (*SheetsMap) GetItem

func (sm *SheetsMap) GetItem(key string) (Item, error)

func (*SheetsMap) GetItemProperty

func (sm *SheetsMap) GetItemProperty(key string, val string) (string, error)

func (*SheetsMap) GetOrCreateItem

func (sm *SheetsMap) GetOrCreateItem(itemKey string) (Item, error)

func (*SheetsMap) GetOrCreateItemWithName

func (sm *SheetsMap) GetOrCreateItemWithName(itemKey, itemName string) (Item, error)

func (*SheetsMap) IsItemComplete

func (sm *SheetsMap) IsItemComplete(item *Item) bool

func (*SheetsMap) IsItemPartial

func (sm *SheetsMap) IsItemPartial(item *Item) bool

func (*SheetsMap) ReadColumns

func (sm *SheetsMap) ReadColumns() error

func (*SheetsMap) ReadItems

func (sm *SheetsMap) ReadItems() error

func (*SheetsMap) SetItemKeyColValue

func (sm *SheetsMap) SetItemKeyColValue(itemKey, colKeyRaw, colValRaw string) (Item, error)

func (*SheetsMap) SetItemKeyDisplay

func (sm *SheetsMap) SetItemKeyDisplay(itemKey, itemDisplay string) error

func (*SheetsMap) SetItemKeyString

func (sm *SheetsMap) SetItemKeyString(itemKey, cmdRaw string) (Intent, error)

func (*SheetsMap) SheetTitle

func (sm *SheetsMap) SheetTitle() string

func (*SheetsMap) SynchronizeItem

func (sm *SheetsMap) SynchronizeItem(item Item) error

func (*SheetsMap) UpdateItem

func (sm *SheetsMap) UpdateItem(item Item, key, val string, synchronize bool) (string, error)

type Stat

type Stat struct {
	Name  string
	Names []string
	Count int64
}

Jump to

Keyboard shortcuts

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