Feat: support using SharePoint site to store files

This commit is contained in:
HFO4
2021-03-12 17:05:13 +08:00
parent a54acd71c2
commit 4e2f243436
9 changed files with 196 additions and 29 deletions

View File

@@ -8,11 +8,12 @@ type Option interface {
}
type options struct {
redirect string
code string
refreshToken string
conflictBehavior string
expires time.Time
redirect string
code string
refreshToken string
conflictBehavior string
expires time.Time
useDriverResource bool
}
type optionFunc func(*options)
@@ -38,13 +39,21 @@ func WithConflictBehavior(t string) Option {
})
}
// WithConflictBehavior 设置文件重名后的处理方式
func WithDriverResource(t bool) Option {
return optionFunc(func(o *options) {
o.useDriverResource = t
})
}
func (f optionFunc) apply(o *options) {
f(o)
}
func newDefaultOption() *options {
return &options{
conflictBehavior: "fail",
expires: time.Now().UTC().Add(time.Duration(1) * time.Hour),
conflictBehavior: "fail",
useDriverResource: true,
expires: time.Now().UTC().Add(time.Duration(1) * time.Hour),
}
}