Select Git revision
-
Md. Alim Ul Karim authoredMd. Alim Ul Karim authored
KeyWithLegend.go 12.06 KiB
package keymk
import (
"fmt"
"strconv"
"strings"
"gitlab.com/evatix-go/core/constants"
"gitlab.com/evatix-go/core/coreinterface/enuminf"
)
// KeyWithLegend
//
// Chain Sequence (Root-Package-Group-State-User-Item)
type KeyWithLegend struct {
option *Option
LegendName LegendName
isAttachLegendNames bool
rootName, packageName string
stateName, groupName string
}
func (it *KeyWithLegend) IsIgnoreLegendAttachments() bool {
return !it.isAttachLegendNames
}
func (it *KeyWithLegend) RootName() string {
return it.rootName
}
func (it *KeyWithLegend) PackageName() string {
return it.packageName
}
func (it *KeyWithLegend) GroupName() string {
return it.groupName
}
// OutputItemsArray
//
// Depending on Options
// - IsIgnoreLegendAttachments() - calls OutputWithoutLegend()
// - or else - calls compiles using legends
//
// Chain may look like:
// - root-package-group-state-user-item
//
// Ordering :
// - Root
// - Package
// - Group
// - State
// - User
// - Item
func (it *KeyWithLegend) OutputItemsArray(request KeyLegendCompileRequest) []string {
if it.IsIgnoreLegendAttachments() {
return it.OutputWithoutLegend(request)
}
slice := make(
[]string,
0,
constants.ArbitraryCapacity14)
isAddRegardless := it.
option.
IsAddEntryRegardlessOfEmptiness()
slice = it.appendLegendNameValue(
isAddRegardless,