module

package
v28.4.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCosmosSDKModulePkg

func IsCosmosSDKModulePkg(path string) bool

IsCosmosSDKModulePkg check if a Go import path is a Cosmos SDK package module. These type of package have the "cosmossdk.io/x" prefix.

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 DiscoverOption

type DiscoverOption func(*discoverOptions)

DiscoverOption configures calls to Discovery function.

func WithProtoDir

func WithProtoDir(path string) DiscoverOption

WithProtoDir sets the relative proto directory path.

func WithSDKDir

func WithSDKDir(path string) DiscoverOption

WithSDKDir sets the absolute directory path to the Cosmos SDK Go package.

type HTTPQuery

type HTTPQuery struct {
	// Name of the RPC func.
	Name string `json:"name,omitempty"`

	// FullName of the query with service name and rpc func name.
	FullName string `json:"full_name,omitempty"`

	// Rules keeps info about configured HTTP rules of RPC functions.
	Rules []protoanalysis.HTTPRule `json:"rules,omitempty"`

	// Paginated indicates that the query is using pagination.
	Paginated bool `json:"paginated,omitempty"`
}

HTTPQuery is an sdk Query.

type Module

type Module struct {
	// Name of the module.
	Name string `json:"name,omitempty"`

	// GoModulePath of the app where the module is defined.
	GoModulePath string `json:"go_module_path,omitempty"`

	// Pkg holds the proto package info.
	Pkg protoanalysis.Package `json:"package,omitempty"`

	// Msgs is a list of sdk.Msg implementation of the module.
	Msgs []Msg `json:"messages,omitempty"`

	// HTTPQueries is a list of module queries.
	HTTPQueries []HTTPQuery `json:"http_queries,omitempty"`

	// Types is a list of proto types that might be used by module.
	Types []Type `json:"types,omitempty"`
}

Module keeps metadata about a Cosmos SDK module.

func Discover

func Discover(ctx context.Context, chainRoot, sourcePath string, options ...DiscoverOption) ([]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 `json:"name,omitempty"`

	// URI of the type.
	URI string `json:"uri,omitempty"`

	// FilePath is the path of the proto file where message is defined.
	FilePath string `json:"file_path,omitempty"`
}

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 of the type.
	Name string `json:"name,omitempty"`

	// FilePath is the path of the .proto file where message is defined at.
	FilePath string `json:"file_path,omitempty"`
}

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