directory

package
v0.0.0-...-7995a24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicServiceLayout

type BasicServiceLayout struct {
	Options *option.Options

	OutputPath string

	APIBasePath string

	CommandBasePath    string
	InternalBasePath   string
	InternalConfigPath string
	ServiceBashPath    string
	ConfigBasePath     string
	BuildBasePath      string
	DeployBasePath     string
}

BasicServiceLayout defines the layout of a general service adapting to the standards of https://github.com/golang-standards/project-layout

func NewBasicServiceLayout

func NewBasicServiceLayout(opts ...option.Option) *BasicServiceLayout

NewBasicServiceLayout returns the basic service directory layout pointer

func (*BasicServiceLayout) GetAPIBasePath

func (layout *BasicServiceLayout) GetAPIBasePath() string

GetAPIBasePath returns the API base path

func (*BasicServiceLayout) GetBuildBasePath

func (layout *BasicServiceLayout) GetBuildBasePath() string

GetBuildBasePath returns the build base path

func (*BasicServiceLayout) GetCommandBasePath

func (layout *BasicServiceLayout) GetCommandBasePath() string

GetCommandBasePath returns the command base path

func (*BasicServiceLayout) GetConfigYAMLBasePath

func (layout *BasicServiceLayout) GetConfigYAMLBasePath() string

GetConfigBasePath returns the config base path

func (*BasicServiceLayout) GetDeployBasePath

func (layout *BasicServiceLayout) GetDeployBasePath() string

GetDeployBasePath returns the deploy base path

func (*BasicServiceLayout) GetGoModuleFilePath

func (layout *BasicServiceLayout) GetGoModuleFilePath() string

GetGoModuleFilePath returns the go.mod file path

func (*BasicServiceLayout) GetInternalBasePath

func (layout *BasicServiceLayout) GetInternalBasePath() string

GetInternalBasePath returns the internal base path

func (*BasicServiceLayout) GetOutputPath

func (layout *BasicServiceLayout) GetOutputPath() string

GetOutputPath returns the output path

func (*BasicServiceLayout) GetServiceBasePath

func (layout *BasicServiceLayout) GetServiceBasePath() string

GetServiceBasePath returns the service base path

func (*BasicServiceLayout) Save

func (layout *BasicServiceLayout) Save() error

Save creates all the generated directory structure

func (*BasicServiceLayout) String

func (layout *BasicServiceLayout) String() string

String returns the JSON format of directory information

type GRPCLayout

type GRPCLayout struct {
	BasicServiceLayout
}

GRPCLayout implements Layout interface to generate gRPC service directory structure

func NewGRPCLayout

func NewGRPCLayout(option ...option.Option) *GRPCLayout

NewGRPCLayout returns the gRPC directory layout pointer

func (*GRPCLayout) GetAPIProtobufBasePath

func (layout *GRPCLayout) GetAPIProtobufBasePath() string

GetAPIProtobufBasePath returns the API protobuf base path

func (*GRPCLayout) GetAPIProtobufFilePath

func (layout *GRPCLayout) GetAPIProtobufFilePath(protoFile string) string

GetAPIProtobufFilePath returns the the API protobuf path connected with protobuf file path and protobuf file name

func (*GRPCLayout) GetAPIProtobufPath

func (layout *GRPCLayout) GetAPIProtobufPath(protoFile string) string

GetAPIProtobufPath returns the the API protobuf path connected with protobuf file path

func (*GRPCLayout) GetConfigGoBasePath

func (layout *GRPCLayout) GetConfigGoBasePath() string

GetConfigGoBasePath returns the config base path

func (*GRPCLayout) GetConfigGoFilePath

func (layout *GRPCLayout) GetConfigGoFilePath() string

GetConfigGoFilePath returns the config.go file path

func (*GRPCLayout) GetConfigPackageName

func (layout *GRPCLayout) GetConfigPackageName(goModule string) string

GetConfigPackageName returns the config package name

func (*GRPCLayout) GetConfigYAMLFilePath

func (layout *GRPCLayout) GetConfigYAMLFilePath() string

GetConfigYAMLFilePath returns the gofra.yaml file path

func (*GRPCLayout) GetGRPCRPCFilePath

func (layout *GRPCLayout) GetGRPCRPCFilePath(service, RPC string) string

GetGRPCRPCFilePath returns the the gateway tRPC path connected with service path and RPC file name

func (*GRPCLayout) GetGRPCServiceBasePath

func (layout *GRPCLayout) GetGRPCServiceBasePath() string

GetGRPCServiceBasePath returns the gateway gRPC base path

func (*GRPCLayout) GetGRPCServiceFilePath

func (layout *GRPCLayout) GetGRPCServiceFilePath(service string) string

GetGRPCServiceFilePath returns the the gateway tRPC path connected with service path and file name

func (*GRPCLayout) GetGRPCServicePath

func (layout *GRPCLayout) GetGRPCServicePath(service string) string

GetGRPCServicePath returns the the gateway gRPC path connected with service path

func (*GRPCLayout) GetMainFilePath

func (layout *GRPCLayout) GetMainFilePath() string

GetMainFilePath returns the main.go file path

func (*GRPCLayout) GetPackageAlias

func (layout *GRPCLayout) GetPackageAlias(packageName string) string

GetPackageAlias returns the package name alias

func (*GRPCLayout) GetProtoImportStub

func (layout *GRPCLayout) GetProtoImportStub(goModule, protoPath string) string

GetProtoImportStub returns the proto import line of code

func (*GRPCLayout) GetProtoPackagePath

func (layout *GRPCLayout) GetProtoPackagePath(goModule, protoFile string) string

GetProtoPackagePath returns the import protobuf package path according to go module path and proto file path

func (*GRPCLayout) GetServiceImportStub

func (layout *GRPCLayout) GetServiceImportStub(goModule, service string) string

GetServiceImportStub returns the service import line of code

func (*GRPCLayout) GetServicePackagePath

func (layout *GRPCLayout) GetServicePackagePath(goModule, service string) string

GetServicePackagePath returns the import package path according to go module path and service name

func (*GRPCLayout) GetServiceRegisterStub

func (layout *GRPCLayout) GetServiceRegisterStub(protoPath, serviceName string) string

GetServiceRegisterStub returns the service register line of code

func (*GRPCLayout) Save

func (layout *GRPCLayout) Save() error

Save creates all the generated directory structure

func (*GRPCLayout) String

func (layout *GRPCLayout) String() string

String returns the JSON format of directory information

type GRPCServiceLayout

type GRPCServiceLayout interface {
	ServiceLayout

	// GetMainFilePath returns the main.go file path, e.g.: /.../cmd/main.go
	GetMainFilePath() string
	// GetAPIProtobufBasePath returns the API protobuf root directory path, e.g.: /.../api/protobuf_spec
	GetAPIProtobufBasePath() string
	// GetAPIProtobufPath returns the specific API directory path, e.g.: /.../api/protobuf_spec/health_check
	GetAPIProtobufPath(protoPath string) string
	// GetAPIProtobufFilePath returns the specific API file path, e.g.: /.../api/protobuf_spec/health_check/health_check.proto
	GetAPIProtobufFilePath(protoFile string) string

	// GetGRPCServiceBasePath returns the gRPC gateway directory path, e.g.: /.../internal/service/grpc
	GetGRPCServiceBasePath() string
	// GetGRPCServicePath returns the specific gRPC gateway directory path, e.g.: /.../internal/service/grpc/health_check
	GetGRPCServicePath(service string) string
	// GetGRPCServiceFilePath returns the specific gRPC gateway service file path, e.g.: /.../internal/service/grpc/health_check/health_check.go
	GetGRPCServiceFilePath(service string) string
	// GetGRPCRPCFilePath returns the specific gRPC gateway RPC file path, e.g.: /.../internal/service/grpc/health_check/check.go
	GetGRPCRPCFilePath(service, RPC string) string

	// GetConfigGoBasePath returns the config path, e.g.: /.../internal/config
	GetConfigGoBasePath() string
	// GetConfigGoFilePath returns the config.go file path, e.g.: /.../internal/config/config.go
	GetConfigGoFilePath() string
	// GetConfigYAMLFilePath returns the gofra.yaml file path, e.g.: /.../configs/gofra.yaml
	GetConfigYAMLFilePath() string
	// GetConfigPackageName returns the package name of config, e.g.: github.com/foo/bar/internal/config
	GetConfigPackageName(goModule string) string

	// GetPackageAlias returns the alias of specific package name
	GetPackageAlias(packageName string) string
	// GetServicePackagePath returns the package path of specific service
	GetServicePackagePath(goModule, service string) string
	// GetProtoPackagePath returns the package path of specific proto file
	GetProtoPackagePath(goModule, protoFile string) string
	// GetServiceRegisterStub returns the stub of specific service of proto
	GetServiceRegisterStub(protoFile, serviceName string) string
	// GetServiceImportStub returns the service import line of code
	GetServiceImportStub(goModule, service string) string
	// GetProtoImportStub returns the proto import line of code
	GetProtoImportStub(goModule, protoPath string) string
}

GRPCServiceLayout defines the layout interface of a gRPC service without

type Layout

type Layout interface {
	Save() error
	String() string
}

Layout interface

type ServiceLayout

type ServiceLayout interface {
	Layout

	// GetOutputPath returns root output directory path, e.g.: /...
	GetOutputPath() string
	// GetGoModuleFilePath returns the go.mod file path, e.g.: /.../go.mod
	GetGoModuleFilePath() string
	// GetCommandBasePath returns the cmd root path, e.g.: /.../cmd
	GetCommandBasePath() string
	// GetAPIBasePath returns the API root directory path, e.g.: /.../api
	GetAPIBasePath() string
	// GetInternalBasePath returns the internal root path, e.g.: /.../internal
	GetInternalBasePath() string
	// GetServiceBasePath returns the cmd root path, e.g.: /.../internal/service
	GetServiceBasePath() string
	// GetConfigYAMLBasePath returns the internal root path, e.g.: /.../configs
	GetConfigYAMLBasePath() string
	// GetBuildBasePath returns the cmd root path, e.g.: /.../build
	GetBuildBasePath() string
	// GetDeployBasePath returns the internal root path, e.g.: /.../deploy
	GetDeployBasePath() string
}

ServiceLayout defines the layout interface of a typical service

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL