package
0.0.47
Repository: https://github.com/hirpc/hrpc.git
Documentation: pkg.go.dev

# README

Introduction

Usages

Customized use case.

func main() {
    s, err := hrpc.NewServer(
		option.WithServerName("orderservice"),
		option.WithDatabases(mysql.New(
            mysql.WithCustomized(), // Very important, if you forget to provide this option, the HRPC will read configuration got from the configuration center to load.
            mysql.WithAddress("xxxx"),
            mysql.WithDB("aaa_db"),
            mysql.WithAuth("user", "pass"),
            mysql.WithPort(12144), // Default 3306
        )),
		option.WithEnvironment(option.Development),
		option.WithHealthCheck(),
	)
    // xxx
}

Customized use case with connection pool

func main() {
    s, err := hrpc.NewServer(
		option.WithServerName("orderservice"),
		option.WithDatabases(mysql.New(
            mysql.WithCustomized(),
            mysql.WithAddress("xxxx"),
            mysql.WithDB("aaa_db"),
            mysql.WithAuth("user", "pass"),
            mysql.WithPort(12144), // Default 3306
            mysql.WithMaxOpenConns(10), // Default 3
            mysql.WithMaxIdleConns(4), // Default 1
        )),
		option.WithEnvironment(option.Development),
		option.WithHealthCheck(),
	)
    // xxx
}

# Functions

Client returns the handler to operate mysql if success.
No description provided by the author
Valid returns a bool valud to determine whether the connection is ready to use.
No description provided by the author
No description provided by the author
WithCustomized will use your own configurations.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author

# Structs

No description provided by the author

# Interfaces

Proxy is a abstract layer for operating the MySQL database.

# Type aliases

NextFunc is designed for scanning all rows queryed from the database If error returned, it will cancel the loop in advance, and it will return the error.
No description provided by the author
TxFunc can be used for transaction operation If error returned, tx.Rollback() will be called automatically If nil returned, tx.Commit() will be called automatically, also.