This commit is contained in:
royalcat 2023-05-24 14:04:29 +03:00
parent b68755771b
commit c19637df51
46 changed files with 103 additions and 103 deletions

2
go.mod
View file

@ -1,4 +1,4 @@
module git.kmsign.com/royalcat/repogen
module git.kmsign.ru/royalcat/repogen
go 1.19

View file

@ -3,7 +3,7 @@ package code_test
import (
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
)
type ErrorTestCase struct {

View file

@ -6,7 +6,7 @@ import (
"reflect"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
)
type TestCase struct {

View file

@ -4,7 +4,7 @@ import (
"reflect"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
)
func TestStructFieldsByName(t *testing.T) {

View file

@ -7,7 +7,7 @@ import (
"go/token"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
)
const goImplFile1Data = `

View file

@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
)
const baseTemplate = `// Code generated by {{.Program}}. DO NOT EDIT.

View file

@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
)
type FunctionBody []Statement

View file

@ -4,8 +4,8 @@ import (
"reflect"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
)
func TestIdentifier(t *testing.T) {

View file

@ -4,7 +4,7 @@ import (
"bytes"
"text/template"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
"golang.org/x/tools/imports"
)

View file

@ -3,9 +3,9 @@ package codegen_test
import (
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/testutils"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/testutils"
)
const expectedBuildCode = `// Code generated by repogen. DO NOT EDIT.

View file

@ -6,7 +6,7 @@ import (
"strings"
"text/template"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
)
const functionTemplate = `

View file

@ -4,9 +4,9 @@ import (
"bytes"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/testutils"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/testutils"
)
func TestFunctionBuilderBuild_NoReturn(t *testing.T) {

View file

@ -5,7 +5,7 @@ import (
"fmt"
"text/template"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
)
const methodTemplate = `

View file

@ -4,9 +4,9 @@ import (
"bytes"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/testutils"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/testutils"
)
func TestMethodBuilderBuild_IgnoreReceiverNoReturn(t *testing.T) {

View file

@ -6,7 +6,7 @@ import (
"strings"
"text/template"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
)
const structTemplate = `

View file

@ -4,9 +4,9 @@ import (
"bytes"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/testutils"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/testutils"
)
const expectedStructBuilderCode = `

View file

@ -1,10 +1,10 @@
package generator
import (
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/mongo"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/mongo"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
// GenerateRepository generates repository implementation code from repository

View file

@ -4,10 +4,10 @@ import (
"os"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/generator"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.com/royalcat/repogen/internal/testutils"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/generator"
"git.kmsign.ru/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/testutils"
)
var (

View file

@ -3,9 +3,9 @@ package mongo
import (
"strings"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
var errOccurred = codegen.RawStatement("err != nil")

View file

@ -1,8 +1,8 @@
package mongo
import (
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
func (g RepositoryGenerator) generateCountBody(

View file

@ -5,11 +5,11 @@ import (
"reflect"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/mongo"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.com/royalcat/repogen/internal/testutils"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/mongo"
"git.kmsign.ru/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/testutils"
)
func TestGenerateMethod_Count(t *testing.T) {

View file

@ -1,8 +1,8 @@
package mongo
import (
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
func (g RepositoryGenerator) generateDeleteBody(

View file

@ -5,11 +5,11 @@ import (
"reflect"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/mongo"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.com/royalcat/repogen/internal/testutils"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/mongo"
"git.kmsign.ru/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/testutils"
)
func TestGenerateMethod_Delete(t *testing.T) {

View file

@ -3,7 +3,7 @@ package mongo
import (
"fmt"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
// NewOperationNotSupportedError creates operationNotSupportedError

View file

@ -3,8 +3,8 @@ package mongo_test
import (
"testing"
"git.kmsign.com/royalcat/repogen/internal/mongo"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/mongo"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
type ErrorTestCase struct {

View file

@ -3,9 +3,9 @@ package mongo
import (
"strconv"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
func (g RepositoryGenerator) generateFindBody(

View file

@ -5,11 +5,11 @@ import (
"reflect"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/mongo"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.com/royalcat/repogen/internal/testutils"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/mongo"
"git.kmsign.ru/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/testutils"
)
func TestGenerateMethod_Find(t *testing.T) {

View file

@ -3,9 +3,9 @@ package mongo
import (
"fmt"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
// NewGenerator creates a new instance of MongoDB repository generator

View file

@ -5,10 +5,10 @@ import (
"reflect"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/mongo"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/mongo"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
var (

View file

@ -1,9 +1,9 @@
package mongo
import (
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
func (g RepositoryGenerator) generateInsertBody(

View file

@ -5,11 +5,11 @@ import (
"reflect"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/mongo"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.com/royalcat/repogen/internal/testutils"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/mongo"
"git.kmsign.ru/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/testutils"
)
func TestGenerateMethod_Insert(t *testing.T) {

View file

@ -4,9 +4,9 @@ import (
"fmt"
"sort"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
type updateField struct {

View file

@ -1,8 +1,8 @@
package mongo
import (
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
func (g RepositoryGenerator) generateUpdateBody(

View file

@ -5,11 +5,11 @@ import (
"reflect"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/codegen"
"git.kmsign.com/royalcat/repogen/internal/mongo"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.com/royalcat/repogen/internal/testutils"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/codegen"
"git.kmsign.ru/royalcat/repogen/internal/mongo"
"git.kmsign.ru/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/testutils"
)
func TestGenerateMethod_Update(t *testing.T) {

View file

@ -5,7 +5,7 @@ import (
"fmt"
"strings"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
)
// parsing error constants

View file

@ -3,8 +3,8 @@ package spec_test
import (
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
type ErrorTestCase struct {

View file

@ -3,7 +3,7 @@ package spec
import (
"strings"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
)
// FieldReference is a reference path to access to the field

View file

@ -1,7 +1,7 @@
package spec
import (
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
)
// QueryMode one or many

View file

@ -3,7 +3,7 @@ package spec_test
import (
"testing"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
type OperationTestCase struct {

View file

@ -3,7 +3,7 @@ package spec
import (
"strconv"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
"github.com/fatih/camelcase"
)

View file

@ -5,8 +5,8 @@ import (
"reflect"
"testing"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
var (

View file

@ -1,7 +1,7 @@
package spec
import (
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/code"
)
// QuerySpec is a set of conditions of querying the database

View file

@ -1,6 +1,6 @@
package spec
import "git.kmsign.com/royalcat/repogen/internal/code"
import "git.kmsign.ru/royalcat/repogen/internal/code"
// UpdateOperation is a method specification for update operations
type UpdateOperation struct {

View file

@ -3,7 +3,7 @@ package spec_test
import (
"testing"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
type UpdateTypeTestCase struct {

View file

@ -3,7 +3,7 @@ package testutils_test
import (
"testing"
"git.kmsign.com/royalcat/repogen/internal/testutils"
"git.kmsign.ru/royalcat/repogen/internal/testutils"
)
func TestExpectMultiLineString(t *testing.T) {

View file

@ -10,14 +10,14 @@ import (
"os"
"path/filepath"
"git.kmsign.com/royalcat/repogen/internal/code"
"git.kmsign.com/royalcat/repogen/internal/generator"
"git.kmsign.com/royalcat/repogen/internal/spec"
"git.kmsign.ru/royalcat/repogen/internal/code"
"git.kmsign.ru/royalcat/repogen/internal/generator"
"git.kmsign.ru/royalcat/repogen/internal/spec"
)
const usageText = `repogen generates MongoDB repository implementation from repository interface
Find more information at: https://git.kmsign.com/royalcat/repogen
Find more information at: https://git.kmsign.ru/royalcat/repogen
Supported options:`