eatonphil/gosql

about bindingPower

Closed this issue · 1 comments

The function mean is ?

func (t Token) bindingPower() uint {
	switch t.Kind {
	case KeywordKind:
		switch Keyword(t.Value) {
		case AndKeyword:
			fallthrough
		case OrKeyword:
			return 1
		}
	case SymbolKind:
		switch Symbol(t.Value) {
		case EqSymbol:
			fallthrough
		case NeqSymbol:
			return 2

		case LtSymbol:
			fallthrough
		case GtSymbol:
			return 3

		// For some reason these are grouped separately
		case LteSymbol:
			fallthrough
		case GteSymbol:
			return 4

		case ConcatSymbol:
			fallthrough
		case PlusSymbol:
			return 5
		}
	}

	return 0
}

Hey! You can find more info on it in this blog post if you search for "bindingPower": https://notes.eatonphil.com/database-basics-expressions-and-where.html.

I try to keep issues to only bug reports though so I'll close this. If you have more questions feel free to send me an email!