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,errormeans 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
AllAnyCatchCodeDelayIgnoreJSONJSONPointerLaxNilNoneNotNotNilNotZeroShallowSmuggleTagZero
bool values (or any type based on bool)
string values (or any type based on string)
AllAnyBetweenCatchCodeContainsDelayEmptyGtGteHasPrefixHasSuffixIgnoreIsaJSONJSONPointerLaxLtLteNoneNotNotEmptyNotZeroReReAllShallowSmuggleStringTagZero
Integer values (uint*, int* or any type based on them)
AllAnyBetweenCatchCodeDelayGtGteIgnoreIsaJSONJSONPointerLaxLtLteNNoneNotNotZeroSmuggleTagZero
Float values (float32, float64 or any type based on them)
AllAnyBetweenCatchCodeDelayGtGteIgnoreIsaJSONJSONPointerLaxLtLteNNaNNoneNotNotNaNNotZeroSmuggleTagZero
Complex values (complex64, complex128 or any type based on them)
Arrays
AllAnyArrayArrayEachBagCapCatchCodeContainsDelayEmptyFirstGrepIgnoreIsaJSONJSONPointerLastLaxLenListNoneNotNotAnyNotEmptyNotZeroSetSmuggleSortSortedSubBagOfSubSetOfSuperBagOfSuperSetOfSuperSliceOfTagZero
Slices
AllAnyArrayEachBagCapCatchCodeContainsDelayEmptyFirstGrepHasPrefixonly[]byteHasSuffixonly[]byteIgnoreIsaJSONJSONPointerLastLaxLenListNilNoneNotNotAnyNotEmptyNotNilNotZeroReonly[]byteReAllonly[]byteSetShallowSliceSmuggleSortSortedStringonly[]byteSubBagOfSubSetOfSuperBagOfSuperSetOfSuperSliceOfTagZero
Maps
AllAnyCatchCodeContainsContainsKeyDelayEmptyIgnoreIsaJSONJSONPointerKeysLaxLenMapMapEachNilNoneNotNotEmptyNotNilNotZeroShallowSmuggleSubJSONOfSubMapOfSuperJSONOfSuperMapOfTagValuesZero
Structs
AllAnyBetweenonlytime.TimeCatchCodeDelayGtonlytime.TimeGteonlytime.TimeIgnoreIsaJSONJSONPointerLaxLtonlytime.TimeLteonlytime.TimeNoneNotNotZeroSStructSmuggleStructSubJSONOfSuperJSONOfTagTruncTimeonlytime.TimeZero
Interface values
As all operators accept interface values, only specific interfaces are listed below:
Contains→fmt.Stringer/errorErrorIsHasPrefix→fmt.Stringer/errorHasSuffix→fmt.Stringer/errorRe→fmt.Stringer/errorReAll→fmt.Stringer/errorString→fmt.Stringer/error
Any pointer
AllAnyArrayonly ptr on arrayArrayEachonly ptr on array/sliceBagonly ptr on array/sliceCatchCodeDelayEmptyonly ptr on array/slice/map/stringFirstonly ptr on array/sliceGreponly ptr on array/sliceIgnoreIsaJSONJSONPointerLastonly ptr on array/sliceLaxListonly ptr on array/sliceMaponly ptr on mapMapEachonly ptr on mapNilNoneNotNotAnyonly ptr on array/sliceNotEmptyonly ptr on array/slice/map/stringNotNilNotZeroPPtrPtrRecvonly ptr on chanSStructonly ptr on structSetonly ptr on array/sliceShallowSliceonly ptr on sliceSmuggleSortonly ptr on array/sliceSortedonly ptr on array/sliceStructonly ptr on structSubBagOfonly ptr on array/sliceSubJSONOfonly ptr on map/structSubMapOfonly ptr on mapSubSetOfonly ptr on array/sliceSuperBagOfonly ptr on array/sliceSuperJSONOfonly ptr on map/structSuperMapOfonly ptr on mapSuperSetOfonly ptr on array/sliceSuperSliceOfonly ptr on array/sliceTagZero
Channels
AllAnyCapCatchCodeDelayEmptyIgnoreIsaLaxLenNilNoneNotNotEmptyNotNilNotZeroRecvShallowSmuggleTagZero