Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mssql support #131

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8bba71b
Expose COLUMN_TYPE column for MySQL
Dec 19, 2017
22b6e38
Merge branch 'master' into new/column-type
Dec 21, 2017
3ea5331
Incorporate sign data into type field
Dec 21, 2017
60d6b92
Return lost table comments in preview
Dec 21, 2017
64c0033
mariadb support: GENERATION_EXPRESSION is nullable
lajosbencz Jan 15, 2020
2550bbd
sqlite-support
lduchosal Feb 5, 2020
4c3c06a
mssql-support
lduchosal Feb 5, 2020
0cdc317
mssql-support
lduchosal Feb 5, 2020
4b805d8
mssql-support
lduchosal Feb 5, 2020
c4b9e15
mssql support
Feb 5, 2020
058d8ce
mssql-support
lduchosal Feb 5, 2020
7faab97
Merge branch 'mssql-support' of https://github.com/lduchosal/gnorm in…
lduchosal Feb 5, 2020
6c8d80b
mssql support
Feb 5, 2020
b8dcd5a
mssql support
Feb 5, 2020
6f23e96
mssql support
Feb 5, 2020
0855c1d
Merge remote-tracking branch 'origin/mssql-support' into mssql-support
Feb 5, 2020
6ee1a4b
mssql support
Feb 6, 2020
52f4467
primary key
lduchosal Feb 6, 2020
ab3e72c
Foreign key on mssql
lduchosal Feb 14, 2020
e0c5b8e
Merge pull request #1 from gnormal/master
lduchosal Sep 11, 2020
bcd7c01
Merge pull request #2 from lduchosal/mssql-support
lduchosal Sep 11, 2020
f9bc710
Merge branch 'master' into sqlite-support
lduchosal Sep 11, 2020
ea476a1
Merge pull request #3 from lduchosal/sqlite-support
lduchosal Sep 11, 2020
65e4229
Merge pull request #4 from lajosbencz/mariadb-support
lduchosal Sep 11, 2020
a117d93
Merge pull request #5 from codercom/new/column-type
lduchosal Sep 11, 2020
3472457
Feat: add stored proc to gnorm
lduchosal Jan 14, 2022
aa02237
Feat: mssql stored proc generation
lduchosal Jan 14, 2022
463f96c
fe
lduchosal Jan 14, 2022
1c50e67
Merge branch 'master' into mssql-support
lduchosal Jan 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/gnorm.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ go:
- tip
- "1.11"
- "1.10"
- "1.9"
# https://github.com/go-sql-driver/mysql/issues/1040
# go-sql-driver/mysql : Go 1.9 is not supported
# - "1.9"

# don't call go get ./... because this hides when deps are
# not packaged into the vendor directory.
Expand Down
129 changes: 92 additions & 37 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions cli/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ type Config struct {
// ./public/users/users.go.
TablePaths map[string]string

// ProcPaths is a set of "output-path" = "template-path" pairs that tells
// Gnorm how to render and output its proc info. Each template will be
// rendered with each proc in turn and written out to the given output
// path. If no pairs are specified, proc will not be rendered.
//
// The proc path may be a template, in which case the values .Schema and
// .Proc may be referenced, containing the name of the current schema and
// pèroc being rendered. For example,
// "{{.Schema}}/{{.Proc}}/{{.Proc}}.go" = "proc.gotmpl" would render
// proc.gotmpl template with data from the the "public.users" proc to
// ./public/users/users.go.
ProcPaths map[string]string

// SchemaPaths is a set of "output-path" = "template-path" pairs that tells
// Gnorm how to render and output its schema info. Each template will be
// rendered with each schema in turn and written out to the given output
Expand Down
27 changes: 22 additions & 5 deletions cli/gnorm.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# ConnStr is the connection string for the database. Any environment variables
# in this string will be expanded, so for example dbname=$MY_DDB will do the
# right thing.
# MySQL example:
# ConnStr = "root:admin@tcp/"
# Postgres example:
# sqlite: ConnStr = "./sqlite.db"
# MySQL: ConnStr = "root:admin@tcp/"
# Postgres: ConnStr = "dbname=mydb host=127.0.0.1 sslmode=disable user=admin"
ConnStr = "dbname=mydb host=127.0.0.1 sslmode=disable user=admin"

# DBType holds the type of db you're connecting to. Possible values are
# "postgres" or "mysql".
# "postgres", "mysql" or "sqlite".
DBType = "postgres"

# Schemas holds the names of schemas to generate code for.
# postgres: "public"
# sqlite: "main"
# Mssql example :
# Schemas = ["dbo"]
Schemas = ["public"]

# PluginDirs a list of paths that will be used for finding plugins. The list
Expand All @@ -37,6 +41,9 @@ IncludeTables = []
# generation. You cannot set ExcludeTables if IncludeTables is set. By
# default, tables will be excluded from all schemas. To specify tables for
# a specific schema only, use the schema.tablenmae format.
# sqlite: ExcludeTables = ["sqlite_sequence", "sqlite_master"]
# Mssql example:
# ExcludeTables = ["sysdiagrams"]
ExcludeTables = ["xyzzx"]

# PostRun is a command with arguments that is run after each file is generated
Expand All @@ -53,7 +60,7 @@ PostRun = ["echo", "$GNORMFILE"]
#
# This defaults to the current working directory i.e the directory in which
# gnorm.toml is found.
OutputDir = "gnorm"
OutputDir = "output"

# StaticDir is the directory relative to the project root (where the
# gnorm.toml file is located) in which all static files , which are
Expand Down Expand Up @@ -119,6 +126,16 @@ NoOverwriteGlobs = ["*.perm.go"]
# not in this mapping, Column.Type will be an empty string. Note that because
# of the way tables in TOML work, TypeMap and NullableTypeMap must be at the end
# of your configuration file.
#
# Example for mapping sqlite types to Go types:
# https://www.sqlite.org/datatype3.html
# [TypeMap]
# "INTEGER" = "int"
# "NUMERIC" = "float64"
# "REAL" = "float64"
# "TEXT" = "string"
# "BLOB" = "byte[]"
#
# Example for mapping postgres types to Go types:
[TypeMap]
"timestamp with time zone" = "time.Time"
Expand Down
Loading