Operators matrices

Operator → go type matrix

Operator vs go type nil bool string {u,}int* float* complex* array slice map struct pointer interface¹ chan func operator
All ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ All
Any ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Any
Array ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ✗ ✗ ptr on array ✓ ✗ ✗ Array
ArrayEach ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ ArrayEach
Bag ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ Bag
Between ✗ ✗ ✓ ✓ ✓ todo ✗ ✗ ✗ time.Time ✗ ✓ ✗ ✗ Between
Cap ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ✗ ✓ ✓ ✗ Cap
Catch ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Catch
Code ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Code
Contains ✗ ✗ ✓ ✗ ✗ ✗ ✓ ✓ ✓ ✗ ✗ ✓ + fmt.Stringer/error ✗ ✗ Contains
Operator vs go type nil bool string {u,}int* float* complex* array slice map struct pointer interface¹ chan func operator
ContainsKey ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ✗ ✓ ✗ ✗ ContainsKey
Delay ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Delay
Empty ✗ ✗ ✓ ✗ ✗ ✗ ✓ ✓ ✓ ✗ ptr on array/slice/map/string ✓ ✓ ✗ Empty
ErrorIs ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ error ✗ ✗ ErrorIs
First ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ First
Grep ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ Grep
Gt ✗ ✗ ✓ ✓ ✓ todo ✗ ✗ ✗ time.Time ✗ ✓ ✗ ✗ Gt
Gte ✗ ✗ ✓ ✓ ✓ todo ✗ ✗ ✗ time.Time ✗ ✓ ✗ ✗ Gte
HasPrefix ✗ ✗ ✓ ✗ ✗ ✗ ✗ []byte ✗ ✗ ✗ ✓ + fmt.Stringer/error ✗ ✗ HasPrefix
HasSuffix ✗ ✗ ✓ ✗ ✗ ✗ ✗ []byte ✗ ✗ ✗ ✓ + fmt.Stringer/error ✗ ✗ HasSuffix
Operator vs go type nil bool string {u,}int* float* complex* array slice map struct pointer interface¹ chan func operator
Ignore ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Ignore
Isa ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Isa
JSON ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✗ JSON
JSONPointer ✓ ✓ ✓ ✓ ✓ ✗ ✓ ✓ ✓ ✓ ✓ ✓ ✗ ✗ JSONPointer
Keys ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ✗ ✓ ✗ ✗ Keys
Last ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ Last
Lax ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Lax
Len ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✓ ✗ ✗ ✓ ✓ ✗ Len
List ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ List
Lt ✗ ✗ ✓ ✓ ✓ todo ✗ ✗ ✗ time.Time ✗ ✓ ✗ ✗ Lt
Operator vs go type nil bool string {u,}int* float* complex* array slice map struct pointer interface¹ chan func operator
Lte ✗ ✗ ✓ ✓ ✓ todo ✗ ✗ ✗ time.Time ✗ ✓ ✗ ✗ Lte
Map ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ptr on map ✓ ✗ ✗ Map
MapEach ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ptr on map ✓ ✗ ✗ MapEach
N ✗ ✗ ✗ ✓ ✓ todo ✗ ✗ ✗ ✗ ✗ ✓ ✗ ✗ N
NaN ✗ ✗ ✗ ✗ ✓ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ✗ NaN
Nil ✓ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✓ ✓ ✓ ✓ Nil
None ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ None
Not ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Not
NotAny ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ NotAny
NotEmpty ✗ ✗ ✓ ✗ ✗ ✗ ✓ ✓ ✓ ✗ ptr on array/slice/map/string ✓ ✓ ✗ NotEmpty
Operator vs go type nil bool string {u,}int* float* complex* array slice map struct pointer interface¹ chan func operator
NotNaN ✗ ✗ ✗ ✗ ✓ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ✗ NotNaN
NotNil ✓ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✓ ✓ ✓ ✓ NotNil
NotZero ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ NotZero
PPtr ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ PPtr
Ptr ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ Ptr
Re ✗ ✗ ✓ ✗ ✗ ✗ ✗ []byte ✗ ✗ ✗ ✓ + fmt.Stringer/error ✗ ✗ Re
ReAll ✗ ✗ ✓ ✗ ✗ ✗ ✗ []byte ✗ ✗ ✗ ✓ + fmt.Stringer/error ✗ ✗ ReAll
Recv ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ptr on chan ✓ ✓ ✗ Recv
Set ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ Set
Shallow ✓ ✗ ✓ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✓ ✓ ✓ ✓ Shallow
Operator vs go type nil bool string {u,}int* float* complex* array slice map struct pointer interface¹ chan func operator
Slice ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ✗ ptr on slice ✓ ✗ ✗ Slice
Smuggle ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Smuggle
Sort ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ Sort
Sorted ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ Sorted
SStruct ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ptr on struct ✓ ✗ ✗ SStruct
String ✗ ✗ ✓ ✗ ✗ ✗ ✗ []byte ✗ ✗ ✗ ✓ + fmt.Stringer/error ✗ ✗ String
Struct ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ptr on struct ✓ ✗ ✗ Struct
SubBagOf ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ SubBagOf
SubJSONOf ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ptr on map/struct ✓ ✗ ✗ SubJSONOf
SubMapOf ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ptr on map ✓ ✗ ✗ SubMapOf
Operator vs go type nil bool string {u,}int* float* complex* array slice map struct pointer interface¹ chan func operator
SubSetOf ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ SubSetOf
SuperBagOf ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ SuperBagOf
SuperJSONOf ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ptr on map/struct ✓ ✗ ✗ SuperJSONOf
SuperMapOf ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ptr on map ✓ ✗ ✗ SuperMapOf
SuperSetOf ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ SuperSetOf
SuperSliceOf ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✓ ✗ ✗ ptr on array/slice ✓ ✗ ✗ SuperSliceOf
Tag ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Tag
TruncTime ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ time.Time todo ✓ ✗ ✗ TruncTime
Values ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✗ ✓ ✗ ✗ ✓ ✗ ✗ Values
Zero ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ ✓ Zero

Legend:

  • ✗ means using this operator with a value type of this kind will always fail
  • ✓ means using this operator with a value type of this kind can succeed
  • []byte, time.Time, ptr on X, fmt.Stringer, error means using this operator with this go type can succeed
  • todo means should be implemented in future (PRs welcome :) )
  • ¹ + ✓ means using this operator with the data behind the interface can succeed

go type → operator matrix

Operators likely to succeed for each go type:

Untyped nil value

bool values (or any type based on bool)

string values (or any type based on string)

Integer values (uint*, int* or any type based on them)

Float values (float32, float64 or any type based on them)

Complex values (complex64, complex128 or any type based on them)

Arrays

Slices

Maps

Structs

Interface values

As all operators accept interface values, only specific interfaces are listed below:

Any pointer

Channels

Functions