eq
Reports numeric equality across the int and float kinds, so 5 equals 5.0.
Numbers and their string form are never equal, so 5 does not equal "5".
float64float64boolstringstringboolanyanyboolReports numeric equality across the int and float kinds, so 5 equals 5.0.
Given
{"total": 5}Template
{{ total | eq:5.0 }}Result
trueReturns false when two numbers differ.
Given
{"total": 3}Template
{{ total | eq:5 }}Result
falseCompares fractional values numerically.
Given
{"price": 2.5}Template
{{ price | eq:2.5 }}Result
trueReports verbatim string equality, the clause reached when neither operand is numeric.
Given
{"status": "active"}Template
{{ status | eq:'active' }}Result
trueReturns false when the strings differ.
Given
{"status": "pending"}Template
{{ status | eq:'active' }}Result
falseCompares multi-byte strings verbatim, so an accented word matches its identical operand.
Given
{"city": "café"}Template
{{ city | eq:'café' }}Result
trueFalls back to Go equality for operands that are neither numeric nor both strings, so a number and its string form are never equal.
Given
{"code": 5}Template
{{ code | eq:'5' }}Result
falseCompares two booleans by value, so a true flag equals true.
Given
{"enabled": true}Template
{{ enabled | eq:true }}Result
true