diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Models.kt index 147ffd7063..77db3a19a9 100644 --- a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Models.kt +++ b/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Models.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.authors.mysql diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Queries.kt index 0eaada1617..d9a7fbf236 100644 --- a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Queries.kt +++ b/examples/kotlin/src/main/kotlin/com/example/authors/mysql/Queries.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.authors.mysql diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/authors/mysql/QueriesImpl.kt index e8efb7c0bb..078684ef6b 100644 --- a/examples/kotlin/src/main/kotlin/com/example/authors/mysql/QueriesImpl.kt +++ b/examples/kotlin/src/main/kotlin/com/example/authors/mysql/QueriesImpl.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.authors.mysql diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Models.kt index c919f666e5..a6948cc650 100644 --- a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Models.kt +++ b/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Models.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.authors.postgresql diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Queries.kt index 6598aabeda..3c27622b8c 100644 --- a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Queries.kt +++ b/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/Queries.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.authors.postgresql diff --git a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/QueriesImpl.kt index a9a813d082..417c81f59e 100644 --- a/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/QueriesImpl.kt +++ b/examples/kotlin/src/main/kotlin/com/example/authors/postgresql/QueriesImpl.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.authors.postgresql diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Models.kt index ba78981fbc..aea30d9341 100644 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Models.kt +++ b/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Models.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.booktest.mysql diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Queries.kt index b6e712fea0..e9ddb09619 100644 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Queries.kt +++ b/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/Queries.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.booktest.mysql diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/QueriesImpl.kt index d922d07ac8..ce6d637e61 100644 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/QueriesImpl.kt +++ b/examples/kotlin/src/main/kotlin/com/example/booktest/mysql/QueriesImpl.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.booktest.mysql diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Models.kt index d2dff24e4a..244997ae63 100644 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Models.kt +++ b/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Models.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.booktest.postgresql diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Queries.kt index 4416dbd24c..c72f3a7b8e 100644 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Queries.kt +++ b/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/Queries.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.booktest.postgresql diff --git a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/QueriesImpl.kt index fbf94fba34..a377db52df 100644 --- a/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/QueriesImpl.kt +++ b/examples/kotlin/src/main/kotlin/com/example/booktest/postgresql/QueriesImpl.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.booktest.postgresql diff --git a/examples/kotlin/src/main/kotlin/com/example/jets/Models.kt b/examples/kotlin/src/main/kotlin/com/example/jets/Models.kt index d2bced3778..6d86810d49 100644 --- a/examples/kotlin/src/main/kotlin/com/example/jets/Models.kt +++ b/examples/kotlin/src/main/kotlin/com/example/jets/Models.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.jets diff --git a/examples/kotlin/src/main/kotlin/com/example/jets/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/jets/Queries.kt index 7f53ec868d..76d2414376 100644 --- a/examples/kotlin/src/main/kotlin/com/example/jets/Queries.kt +++ b/examples/kotlin/src/main/kotlin/com/example/jets/Queries.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.jets diff --git a/examples/kotlin/src/main/kotlin/com/example/jets/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/jets/QueriesImpl.kt index 717beb6082..69e1be7d3c 100644 --- a/examples/kotlin/src/main/kotlin/com/example/jets/QueriesImpl.kt +++ b/examples/kotlin/src/main/kotlin/com/example/jets/QueriesImpl.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.jets diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Models.kt index 5bbfd046ce..0e7caa8133 100644 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Models.kt +++ b/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Models.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.ondeck.mysql diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Queries.kt index 005299ea8a..8865abb315 100644 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Queries.kt +++ b/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/Queries.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.ondeck.mysql diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/QueriesImpl.kt index a30b7564c5..2f1c67fd0b 100644 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/QueriesImpl.kt +++ b/examples/kotlin/src/main/kotlin/com/example/ondeck/mysql/QueriesImpl.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.ondeck.mysql diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Models.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Models.kt index e86b4e8ce4..ccec13ecd3 100644 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Models.kt +++ b/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Models.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.ondeck.postgresql diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Queries.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Queries.kt index 31bde13c9c..c68b1112eb 100644 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Queries.kt +++ b/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/Queries.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.ondeck.postgresql diff --git a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/QueriesImpl.kt b/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/QueriesImpl.kt index 4c4e07589d..d1d8c3bbda 100644 --- a/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/QueriesImpl.kt +++ b/examples/kotlin/src/main/kotlin/com/example/ondeck/postgresql/QueriesImpl.kt @@ -1,4 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.12.0 package com.example.ondeck.postgresql diff --git a/internal/codegen/kotlin/gen.go b/internal/codegen/kotlin/gen.go index dc128a5e7f..d6cb0671a7 100644 --- a/internal/codegen/kotlin/gen.go +++ b/internal/codegen/kotlin/gen.go @@ -12,6 +12,7 @@ import ( "github.com/kyleconroy/sqlc/internal/codegen/sdk" "github.com/kyleconroy/sqlc/internal/inflection" + "github.com/kyleconroy/sqlc/internal/info" "github.com/kyleconroy/sqlc/internal/metadata" "github.com/kyleconroy/sqlc/internal/plugin" ) @@ -533,6 +534,8 @@ func buildQueries(req *plugin.CodeGenRequest, structs []Struct) ([]Query, error) } var ktIfaceTmpl = `// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc {{.SqlcVersion}} package {{.Package}} @@ -564,6 +567,8 @@ interface Queries { ` var ktModelsTmpl = `// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc {{.SqlcVersion}} package {{.Package}} @@ -601,6 +606,8 @@ data class {{.Name}} ( {{- range $i, $e := .Fields}} ` var ktSqlTmpl = `// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc {{.SqlcVersion}} package {{.Package}} @@ -723,6 +730,7 @@ type ktTmplCtx struct { DataClasses []Struct Queries []Query Settings *plugin.Settings + SqlcVersion string // TODO: Race conditions SourceName string @@ -785,6 +793,7 @@ func Generate(req *plugin.CodeGenRequest) (*plugin.CodeGenResponse, error) { Queries: queries, Enums: enums, DataClasses: structs, + SqlcVersion: info.Version, } output := map[string]string{}