1 Star 0 Fork 0

ivfzhou / tus_client

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
options.go 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
ivfzhou 提交于 2024-04-14 17:36 . feat: 添加log函数
/*
* Copyright (c) 2023 ivfzhou
* tus_client is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
package tus_client
import (
"context"
"net/http"
)
type Logger interface {
Error(ctx context.Context, msg string)
Info(ctx context.Context, msg string)
Warn(ctx context.Context, msg string)
Debug(ctx context.Context, msg string)
}
type Options struct {
hc *http.Client
schema string
chunkSize int
logger Logger
}
type Option func(*Options)
func WithHTTPClient(c *http.Client) Option {
return func(o *Options) {
o.hc = c
}
}
func WithSchema(schema string) Option {
return func(o *Options) {
o.schema = schema
}
}
func WithChunkSize(chunkSize int) Option {
return func(o *Options) {
o.chunkSize = chunkSize
}
}
func WithLogger(logger Logger) Option {
return func(o *Options) {
o.logger = logger
}
}
1
https://gitee.com/ivfzhou/tus_client.git
git@gitee.com:ivfzhou/tus_client.git
ivfzhou
tus_client
tus_client
master

搜索帮助