From abea50fbae8c6b5ac1bf8a294f1fcd51ba9b43ce Mon Sep 17 00:00:00 2001
From: Garet Halliday <ghalliday@gfxlabs.io>
Date: Thu, 29 Sep 2022 16:03:12 -0500
Subject: [PATCH] truncate pls

---
 lib/gat/database/query_router/query_router.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/gat/database/query_router/query_router.go b/lib/gat/database/query_router/query_router.go
index 922e4b11..0e233388 100644
--- a/lib/gat/database/query_router/query_router.go
+++ b/lib/gat/database/query_router/query_router.go
@@ -90,7 +90,12 @@ func (r *QueryRouter) InferRole(query string) (config.ServerRole, error) {
 	var role = config.SERVERROLE_REPLICA
 	for _, token := range tokens {
 		switch token.Token {
-		case lex.KeywordUpdate, lex.KeywordDelete, lex.KeywordInsert, lex.KeywordDrop, lex.KeywordCreate, lex.KeywordTruncate:
+		case lex.KeywordUpdate,
+			lex.KeywordDelete,
+			lex.KeywordInsert,
+			lex.KeywordDrop,
+			lex.KeywordCreate,
+			lex.KeywordTruncate:
 			role = config.SERVERROLE_PRIMARY
 		}
 	}
-- 
GitLab