package
Version:
v2.0.0-...-4b7107c
Opens a new window with list of versions in this module.
Published: Jul 5, 2023
License: MIT
Opens a new window with license information.
Imports: 5
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
simpleSet
Description
A simple golang set because who wants to reinvent wheels all the time
when you really just want to solve problems?
Methods
Method |
Syntax |
Description |
Add() |
.Add(item any) error |
Add a item to set. Throw error type check fails |
Count() |
.Count() int |
Return a count of records |
Delete() |
.Delete(item any) error |
Delete an existing record |
Empty() |
.Empty() bool |
Returns boolean true if set empty or set is uninitialized |
GetFirst() |
.GetFirst() any |
Returns the first record in the set (not always first added) |
GetType() |
.GetType() reflect.Kind |
Returns the set type |
Has() |
.Has(item any) bool |
Return true if item exists or false otherwise. |
Init() |
.Init() |
Initialize the state's internal data structure |
List() |
.List() (result []any) |
Return a list of items |
ListString() |
.ListString(sort bool) (result []string) |
Return the set as a list of strings. |
TypeCheck() |
.TypeCheck(item any) bool |
Return bool true if set empty or of same type |
Documentation
¶
Set - Create map of any to its type
Add - add item to set (all items must be of the same type).
Count - return a count of the records in a set
func (set *Set) Delete(item interface{}) error
Delete - delete an item from the set
func (set *Set) GetFirst() any
GetType - Return the type of the first item (indicating type of the set)
Has - return true if row exists
Init - Initialize the state's internal data structure
func (set *Set) List() (result []any)
List - Return a list of items
ListString - return teh set as a list of strings
TypeCheck - Return whether item is of the same type as the set (empty defaults to true)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.