api

package
v0.3.1-0...-ee1233d Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitFromConfig

func InitFromConfig(ctx context.Context, api *API, cfg *Config) (err error)

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func (*API) Close

func (api *API) Close(ctx context.Context)

func (*API) InitFromCli

func (api *API) InitFromCli(ctx context.Context, c *cli.Context) error

func (*API) Name

func (api *API) Name() string

func (*API) Start

func (api *API) Start() error

nolint: funlen

type Config

type Config struct {
	// db configs
	DatabaseUsername        string
	DatabasePassword        string
	DatabaseName            string
	DatabaseHost            string
	DatabaseMaxIdleConns    uint64
	DatabaseMaxOpenConns    uint64
	DatabaseMaxConnLifetime uint64
	CORSOrigins             []string
	// rpc configs
	SrcRPCUrl  string
	DestRPCUrl string
	HTTPPort   uint64
	OpenDBFunc func() (DB, error)
}

func NewConfigFromCliContext

func NewConfigFromCliContext(c *cli.Context) (*Config, error)

NewConfigFromCliContext creates a new config instance from command line flags.

type DB

type DB interface {
	DB() (*sql.DB, error)
	GormDB() *gorm.DB
}

Jump to

Keyboard shortcuts

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