Documentation ¶
Index ¶
- func SetAliases(a Aliases) func(*Table) error
- func SetColumns(c []string) func(*Table) error
- func SetHeaders(h bool) func(*Table) error
- func SetNumbers(n bool) func(*Table) error
- func SetTableWriter(w io.Writer) func(*Table) error
- func TStoString(ts time.Time) string
- type Alias
- type Aliases
- type AliasesMap
- type Filter
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetAliases ¶
SetAliases is a Table option for setting the aliases.
func SetColumns ¶
SetColumns is a Table option for setting the columns to display.
func SetHeaders ¶
SetHeaders is a Table option for setting the option to display headers.
func SetNumbers ¶
SetNumbers is a Table option for setting the option to display numbers.
func SetTableWriter ¶
SetTableWriter is a Table option for setting the writer.
func TStoString ¶
TStoString converts a timestamp to RFC3339 format string. If the time is the zero time, it is rendered as an empty string. The string is returned.
Types ¶
type Alias ¶
type Alias struct { Alias string Domain string EmailAddresses []string `column:"Email Address(es)"` Description string Suspended bool CreatedTS time.Time `column:"Created Time"` ModifiedTS time.Time `column:"Modified Time"` SuspendedTS time.Time `column:"Suspended Time"` }
Alias represents the state necessary for an email alias.
func (Alias) Equal ¶
Equal checks for equality between two Alias types. All fields are checked for equality and all of them must match. A true value is returned when all fields match. When a field does not match, an error specifying the mismatched field is returned.
func (Alias) Fields ¶
Fields returns a slice of strings composed of the field names of the Alias struct.
func (Alias) Filter ¶
Filter applies the fields in a Filter struct against the fields on an Alias struct. If all Alias fields match against the Filter struct, then true is returned. Otherwise, false is returned.
func (Alias) Key ¶
Key returns a key name for maps based on the Alias and Domain fields which should be unique.
func (Alias) StripData ¶
StripData takes a list for field names as a string slice. Any field name not present in the string slice has it's field value set to the zero value. An Alias with all the specified values still set is returned as well as an error if there was a problem setting a field value.
func (Alias) UnifiedDiff ¶
UnifiedDiff returns a unified text diff of both Alias(es). Otherwise it returns an empty string.
type Aliases ¶
type Aliases []Alias
Aliases represents a slice of Alias structs.
func (Aliases) Diff ¶
Diff is the difference between two slices of Alias. A slice of Alias of the elements not in common are returned and are sorted.
func (Aliases) StripData ¶
StripData takes a list for field names as a string slice. Any field name not present in the string slice has it's field value set to the zero value. This is applied to all elements of the Aliases type. The stripped data is returned as well as an error if there was a problem setting a field value.
func (Aliases) ToMap ¶
func (s Aliases) ToMap() AliasesMap
ToMap transforms an Aliases type to an AliasesMap type.
type AliasesMap ¶
AliasesMap represents a map of Alias structs. The key is based on the Alias and Domain fields of the Alias structs.
func (AliasesMap) Del ¶
func (m AliasesMap) Del(a Alias)
Del removes an Alias from an AliasMap type.
func (AliasesMap) ToSlice ¶
func (m AliasesMap) ToSlice() Aliases
ToSlice transforms an AliasesMap type to an Aliases type. The returned Aliases type is sorted.
type Filter ¶
type Filter struct { Alias *regexp.Regexp Domain *regexp.Regexp EmailAddress *regexp.Regexp Description *regexp.Regexp ExcludeSuspended bool ExcludeEnabled bool }
Filter is the settings for filtering aliases. There are regexps for aliases, domains, email addresses and descriptions. By default enabled and suspended aliases will be included. There are options to exclude enabled and/or suspended aliases.