1 Star 0 Fork 0

nanjo_fan / goharbor-client

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
options.go 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
王帆 提交于 2023-02-13 08:49 . first commit
package config
import (
"time"
)
// Options defines optional parameters for configuring an API client.
type Options struct {
// PageSize used for the client operations, a maximum of 100 is enforced by the Goharbor API.
PageSize int64
// Page to be used for client operations.
Page int64
// The timeout for client operations.
Timeout time.Duration
// Sort string used on 'list' client operations.
Sort string
// Query string used for client operations.
Query string
}
func Defaults() *Options {
return &Options{
PageSize: 10,
Page: 1,
Sort: "",
Query: "",
Timeout: 30 * time.Second,
}
}
func (o *Options) WithPageSize(pageSize int64) *Options {
o.PageSize = pageSize
return o
}
func (o *Options) WithPage(page int64) *Options {
o.Page = page
return o
}
func (o *Options) WithTimeout(timeout time.Duration) *Options {
o.Timeout = timeout
return o
}
func (o *Options) WithSort(sort string) *Options {
o.Sort = sort
return o
}
func (o *Options) WithQuery(query string) *Options {
o.Query = query
return o
}
Go
1
https://gitee.com/nanjo-fan/goharbor-client.git
git@gitee.com:nanjo-fan/goharbor-client.git
nanjo-fan
goharbor-client
goharbor-client
v1.0.2

搜索帮助