From 68f27bbc8cfd4a55be1eb40ee1d6a9a902e3f5c8 Mon Sep 17 00:00:00 2001 From: zardilior Date: Wed, 6 Mar 2019 12:11:43 -0600 Subject: [PATCH] like syntactic sugar --- orator/query/builder.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/orator/query/builder.py b/orator/query/builder.py index 60f59c10..76bd1208 100644 --- a/orator/query/builder.py +++ b/orator/query/builder.py @@ -688,6 +688,15 @@ def dynamic_where(*parameters): def _add_dynamic(self, segment, connector, parameters, index): self.where(segment, '=', parameters[index], connector) + def starts_with(self, column, search): + return self.where(column, 'LIKE', '{}%'.format(search)) + + def like(self, column, search): + return self.where(column, 'LIKE', '%{}%'.format(search)) + + def ends_with(self, column, search): + return self.where(column, 'LIKE', '%{}'.format(search)) + def group_by(self, *columns): """ Add a "group by" clause to the query