From f38000ca87fcd0742e2a47f7ac0dfe8e87711923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20Sala=C3=BCn?= Date: Fri, 14 May 2021 10:25:47 +0200 Subject: [PATCH] feat: add Like and Overlap to Call --- stmt/expression.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/stmt/expression.go b/stmt/expression.go index 03b1110..2261204 100644 --- a/stmt/expression.go +++ b/stmt/expression.go @@ -535,6 +535,12 @@ func (call Call) LessThan(value interface{}) InfixExpression { return NewInfixExpression(call, operator, NewWrapper(NewExpression(value))) } +// Like performs a "like" condition. +func (call Call) Like(value interface{}) InfixExpression { + operator := NewComparisonOperator(types.Like) + return NewInfixExpression(call, operator, NewExpression(value)) +} + // ILike performs a "ilike" condition. func (call Call) ILike(value interface{}) InfixExpression { operator := NewComparisonOperator(types.ILike) @@ -546,6 +552,12 @@ func (call Call) In(value ...interface{}) In { return NewIn(call, NewArrayExpression(value...)) } +// Overlap performs an "overlap" comparison. +func (call Call) Overlap(what interface{}) InfixExpression { + operator := NewComparisonOperator(types.Overlap) + return NewInfixExpression(call, operator, NewWrapper(NewExpression(what))) +} + // IsEmpty reports whether call is empty. func (call Call) IsEmpty() bool { return false