From 59ba56d29a36a747c3f3086897c8cb876900aa8e Mon Sep 17 00:00:00 2001 From: vahagz Date: Tue, 6 Feb 2024 19:04:02 +0400 Subject: [PATCH] added templates for each query --- services/parser/query/ddl/create/table.go | 9 +++++++++ services/parser/query/dml/delete.go | 5 +++++ services/parser/query/dml/insert.go | 7 +++++++ services/parser/query/dml/prepare.go | 3 +++ services/parser/query/dml/select.go | 6 ++++++ services/parser/query/dml/update.go | 9 +++++++++ 6 files changed, 39 insertions(+) diff --git a/services/parser/query/ddl/create/table.go b/services/parser/query/ddl/create/table.go index 1c8257b..9566267 100644 --- a/services/parser/query/ddl/create/table.go +++ b/services/parser/query/ddl/create/table.go @@ -10,6 +10,15 @@ import ( "go-dbms/services/parser/query/ddl/create/types" ) +/* +CREATE TABLE ( + [AUTO INCREMENT], + ... +) +PRIMARY KEY (<...columns>) +[, INDEX(<...columns>) ] +...; +*/ type QueryCreateTable struct { *QueryCreate Database string `json:"database"` diff --git a/services/parser/query/dml/delete.go b/services/parser/query/dml/delete.go index bd761f5..ec97144 100644 --- a/services/parser/query/dml/delete.go +++ b/services/parser/query/dml/delete.go @@ -10,6 +10,11 @@ import ( "go-dbms/services/parser/query" ) +/* +DELETE FROM +[WHERE_INDEX [AND ]] +[WHERE <...condition>]; +*/ type QueryDelete struct { query.Query DB string `json:"db"` diff --git a/services/parser/query/dml/insert.go b/services/parser/query/dml/insert.go index e70c5d0..7d3bfc4 100644 --- a/services/parser/query/dml/insert.go +++ b/services/parser/query/dml/insert.go @@ -10,6 +10,13 @@ import ( "go-dbms/services/parser/query" ) +/* +INSERT INTO (...columns) +VALUES + (...values) + ... + (...values); +*/ type QueryInsert struct { query.Query DB string `json:"db"` diff --git a/services/parser/query/dml/prepare.go b/services/parser/query/dml/prepare.go index 86f44fb..6a1f8a6 100644 --- a/services/parser/query/dml/prepare.go +++ b/services/parser/query/dml/prepare.go @@ -9,6 +9,9 @@ import ( "go-dbms/services/parser/query" ) +/* +PREPARE TABLE ROWS ; +*/ type QueryPrepare struct { query.Query DB string diff --git a/services/parser/query/dml/select.go b/services/parser/query/dml/select.go index 34f3724..f9dd96f 100644 --- a/services/parser/query/dml/select.go +++ b/services/parser/query/dml/select.go @@ -11,6 +11,12 @@ import ( "go-dbms/services/parser/query" ) +/* +SELECT <...columns> +FROM +[WHERE_INDEX [AND ]] +[WHERE <...condition>]; +*/ type QuerySelect struct { query.Query Columns []string `json:"columns"` diff --git a/services/parser/query/dml/update.go b/services/parser/query/dml/update.go index 526573f..af94ccf 100644 --- a/services/parser/query/dml/update.go +++ b/services/parser/query/dml/update.go @@ -10,6 +10,15 @@ import ( "go-dbms/services/parser/query" ) +/* +UPDATE +SET + = , + ... + = +[WHERE_INDEX [AND ]] +[WHERE <...condition>]; +*/ type QueryUpdate struct { query.Query DB string `json:"db"`