g

package
v0.0.0-...-075f0a8 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package generator stores global variables

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServiceNotFound            = errors.New("service not found")
	ErrProtocNotFound             = errors.New("protoc not found")
	ErrInvalidGeneratorParameters = errors.New("invalid base generator parameters")
	ErrInterfaceNotFound          = errors.New("interface not found")
	ErrMethodNotFound             = errors.New("method not found")
	ErrFuncTypeNotFound           = errors.New("funcType not found")
	ErrVarNotFound                = errors.New("var not found")
	ErrConstNotFound              = errors.New("const not found")
	ErrStructureNotFound          = errors.New("structure not found")
)
View Source
var (
	ImportPaths = map[ImportType]string{
		HdSdk:       "github.com/hdget/hdsdk",
		HdSdkTypes:  "github.com/hdget/hdsdk/types",
		HdUtils:     "github.com/hdget/hdsdk/utils",
		HdWs:        "github.com/hdget/hdsdk/lib/ws",
		HdParallel:  "github.com/hdget/hdsdk/utils/parallel",
		KitEndpoint: "github.com/go-kit/kit/endpoint",
		KitGrpc:     "github.com/go-kit/kit/transport/grpc",
		KitHttp:     "github.com/go-kit/kit/transport/http",
		Cobra:       "github.com/spf13/cobra",
		Errors:      "github.com/pkg/errors",
		StdGrpc:     "google.golang.org/grpc",
		StdHttp:     "net/http",
		StdJson:     "encoding/json",
		DaprGrpc:    "github.com/dapr/go-sdk/service/grpc",
		DaprHttp:    "github.com/dapr/go-sdk/service/http",
		DaprCommon:  "github.com/dapr/go-sdk/service/common",
	}
)

Functions

func GetDir

func GetDir(rootDir string, dirType DirType) string

GetDir get default project dir

Types

type DirType

type DirType int
const (
	Binary DirType
	Proto
	Global
	Config
	Service
	Pb
	Grpc
	Http
	Cmd
	Setting
)

type ImportType

type ImportType int
const (
	HdSdk ImportType
	HdSdkTypes
	HdUtils
	HdWs
	HdParallel
	KitEndpoint
	KitGrpc
	KitHttp
	DaprGrpc
	DaprHttp
	DaprCommon
	Cobra
	Errors
	StdGrpc
	StdHttp
	StdJson
)

type KitFs

type KitFs struct {
	Fs afero.Fs
}

KitFs wraps an afero.Fs

func GetFs

func GetFs() *KitFs

GetFs returns a new KitFs if it was not initiated before or it returns the existing gKitFs if it is initiated.

func NewKitFs

func NewKitFs(rootDir string) *KitFs

NewKitFs creates a KitFs with `dir` as root.

func (*KitFs) Copy

func (kf *KitFs) Copy(sourcePath, destPath string) error

func (*KitFs) Exists

func (kf *KitFs) Exists(path string) (bool, error)

Exists returns true,nil if the dir/file exists or false,nil if the dir/file does not exist, it will return an error if something went wrong.

func (*KitFs) IsDir

func (kf *KitFs) IsDir(path string) (bool, error)

func (*KitFs) MakeDir

func (kf *KitFs) MakeDir(path string) error

MakeDir create dif if not exists

func (*KitFs) ReadFile

func (kf *KitFs) ReadFile(path string) ([]byte, error)

ReadFile reads the file from `path` and returns the content in string format or returns an error if it occurs.

func (*KitFs) WriteFile

func (kf *KitFs) WriteFile(path string, data []byte, force bool) error

WriteFile writs a file to the `path` with `data` as content, if `force` is set to true it will override the file if it already exists.

Jump to

Keyboard shortcuts

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