This topic describes how to search for the required RPM packages by using obshell-sdk-go.
Note
Before you proceed, we recommend that you read Get Started with obshell-sdk-go to learn how to use obshell-sdk-go.
Sample code
Search for the latest RPM package
package main import ( "fmt" "github.com/oceanbase/obshell-sdk-go/util" ) func SearchDiffArch() { // Search for the latest obshell package with the specified architecture. entry := util.PackageEntry{ Name: "obshell", } // Specify the architecture and system as aarch64 and el8, respectively. mirror := util.OB_COMMUNITY_STABLE_BASE.GetMirror(util.AARCH64, util.EL8) pkgs, err := mirror.Search(entry) if err != nil { panic(err) } for _, pkg := range pkgs { fmt.Println(pkg) } }Search for an RPM package of a specified version
package main import ( "fmt" "github.com/oceanbase/obshell-sdk-go/util" ) // Search for the obshell package of a specified architecture and version. func SearchDiffArchVersion() { entry := util.PackageEntry{ Name: "obshell", Version: "4.2.4.0", } // Specify the architecture and system as aarch64 and el8, respectively. mirror := util.OB_COMMUNITY_STABLE_BASE.GetMirror(util.AARCH64, util.EL8) pkgs, err := mirror.Search(entry) if err != nil { panic(err) } for _, pkg := range pkgs { fmt.Println(pkg) } }
Related documents
For more information on how to request APIs using the obshell-sdk-python, see Search for an RPM package.