module

package
v0.0.0-...-d298eb8 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRootPath

func IsRootPath(path string) bool

IsRootPath checks if a Go import path is a custom app module. Custom app modules are defined inside the "x" directory.

func RootGoImportPath

func RootGoImportPath(importPath string) string

RootGoImportPath returns a Go import path with the version suffix removed.

func RootPath

func RootPath(path string) string

RootPath returns the Go import path of a custom app module. An empty string is returned when the path doesn't belong to a custom module.

Types

type HTTPQuery

type HTTPQuery struct {
	// Name of the RPC func.
	Name string

	// FullName of the query with service name and rpc func name.
	FullName string

	// HTTPAnnotations keeps info about http annotations of query.
	Rules []protoanalysis.HTTPRule

	// Paginated indicates that the query is using pagination.
	Paginated bool
}

HTTPQuery is an sdk Query.

type Module

type Module struct {
	// Name of the module.
	Name string

	// GoModulePath of the app where the module is defined.
	GoModulePath string

	// Pkg holds the proto package info.
	Pkg protoanalysis.Package

	// Msg is a list of sdk.Msg implementation of the module.
	Msgs []Msg

	// HTTPQueries is a list of module queries.
	HTTPQueries []HTTPQuery

	// Types is a list of proto types that might be used by module.
	Types []Type
}

Module keeps metadata about a Cosmos SDK module.

func Discover

func Discover(ctx context.Context, chainRoot, sourcePath, protoDir string) ([]Module, error)

Discover discovers and returns modules and their types that are registered in the app chainRoot is the root path of the chain sourcePath is the root path of the go module which the proto dir is from

Discovery algorithm make use of registered modules and proto definitions to find relevant registered modules. It does so by: 1. Getting all the registered Go modules from the app. 2. Parsing the proto files to find services and messages. 3. Check if the proto services are implemented in any of the registered modules.

type Msg

type Msg struct {
	// Name of the type.
	Name string

	// URI of the type.
	URI string

	// FilePath is the path of the .proto file where message is defined at.
	FilePath string
}

Msg keeps metadata about an sdk.Msg implementation.

type Msgs

type Msgs map[string][]string

Msgs is a module import path-sdk msgs pair.

type Type

type Type struct {
	Name string

	// FilePath is the path of the .proto file where message is defined at.
	FilePath string
}

Type is a proto type that might be used by module.

Jump to

Keyboard shortcuts

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