Skip to content

Commit

Permalink
Rename gen package to be more descriptive
Browse files Browse the repository at this point in the history
  • Loading branch information
pablojimpas committed Jul 9, 2024
1 parent cffde13 commit cfc3b46
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: BSD-3-Clause

package gen
package template

import (
"embed"
Expand Down Expand Up @@ -47,15 +47,15 @@ type CrudParams struct {
HeaderParams
}

func ApplySchemaTemplate(w io.Writer, p SchemaParams) error {
func ApplySchema(w io.Writer, p SchemaParams) error {
if err := headerTmpl.Execute(w, p.HeaderParams); err != nil {
return err
}

return schemaTmpl.Execute(w, p)
}

func ApplyCrudTemplate(w io.Writer, p CrudParams) error {
func ApplyCrud(w io.Writer, p CrudParams) error {
if err := headerTmpl.Execute(w, p.HeaderParams); err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package gen_test
// SPDX-FileCopyrightText: 2024 Pablo Jiménez Pascual <pablo@jimpas.me>
//
// SPDX-License-Identifier: BSD-3-Clause

package template_test

import (
"bytes"
"testing"

"github.com/pablojimpas/protoc-gen-sqlc/internal/core"
"github.com/pablojimpas/protoc-gen-sqlc/internal/gen"
"github.com/pablojimpas/protoc-gen-sqlc/internal/sqlc/template"
)

func TestApplySchemaTemplate(t *testing.T) {
Expand Down Expand Up @@ -38,7 +42,7 @@ func TestApplySchemaTemplate(t *testing.T) {
}

var buf bytes.Buffer
err := gen.ApplySchemaTemplate(&buf, gen.SchemaParams{schema, gen.Options{}, gen.HeaderParams{}})
err := template.ApplySchema(&buf, template.SchemaParams{schema, template.Options{}, template.HeaderParams{}})
if err != nil {
t.Error(err)
}
Expand Down

0 comments on commit cfc3b46

Please sign in to comment.