Documentation ¶
Overview ¶
Package identity provides a small set of utilities for dealing with structs that have an identifier.
Why does this exist? Because, for example, you can't have `Set(v string, ids ...Identifier)` and:
profiles := []*Profile{ ... } identity.Set(v, profiles...)
With the above code, you get:
cannot use p.Profiles (type []*Profile) as type []identity.Identifier in argument to identity.Set
Even though this works:
profiles := []*Profile{ ... } identity.Set(v, profiles[0], profiles[1])
tl;dr generics please? :(
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
func Get(k string, ids []Identifier) (interface{}, bool)
Get finds and returns the value and true if k exists in given ids
func Remove ¶
func Remove(k string, ids *[]Identifier) bool
Remove deletes identifier with name k in given ids
func Set ¶
func Set(new Identifier, ids *[]Identifier)
Set updates an existing entry with the same name as k, or just adds it
Types ¶
type Identifier ¶
type Identifier interface{ Identifier() string }
Identifier wraps classes with Identifier()
Click to show internal directories.
Click to hide internal directories.