mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-21 15:54:13 +00:00
webdav: move ConditionalMatch to webdav.go
It's not an XML element.
This commit is contained in:
parent
b821d8c1ea
commit
ced348a58f
21
elements.go
21
elements.go
@ -30,24 +30,3 @@ type groupMembership struct {
|
||||
XMLName xml.Name `xml:"DAV: group-membership"`
|
||||
Hrefs []internal.Href `xml:"href"`
|
||||
}
|
||||
|
||||
// ConditionalMatch represents the value of a conditional header
|
||||
// according to RFC 2068 section 14.25 and RFC 2068 section 14.26
|
||||
// The (optional) value can either be a wildcard or an ETag.
|
||||
type ConditionalMatch string
|
||||
|
||||
func (val ConditionalMatch) IsSet() bool {
|
||||
return val != ""
|
||||
}
|
||||
|
||||
func (val ConditionalMatch) IsWildcard() bool {
|
||||
return val == "*"
|
||||
}
|
||||
|
||||
func (val ConditionalMatch) ETag() (string, error) {
|
||||
var e internal.ETag
|
||||
if err := e.UnmarshalText([]byte(val)); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(e), nil
|
||||
}
|
||||
|
23
webdav.go
23
webdav.go
@ -5,6 +5,8 @@ package webdav
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/emersion/go-webdav/internal"
|
||||
)
|
||||
|
||||
// FileInfo holds information about a WebDAV file.
|
||||
@ -25,3 +27,24 @@ type CopyOptions struct {
|
||||
type MoveOptions struct {
|
||||
NoOverwrite bool
|
||||
}
|
||||
|
||||
// ConditionalMatch represents the value of a conditional header
|
||||
// according to RFC 2068 section 14.25 and RFC 2068 section 14.26
|
||||
// The (optional) value can either be a wildcard or an ETag.
|
||||
type ConditionalMatch string
|
||||
|
||||
func (val ConditionalMatch) IsSet() bool {
|
||||
return val != ""
|
||||
}
|
||||
|
||||
func (val ConditionalMatch) IsWildcard() bool {
|
||||
return val == "*"
|
||||
}
|
||||
|
||||
func (val ConditionalMatch) ETag() (string, error) {
|
||||
var e internal.ETag
|
||||
if err := e.UnmarshalText([]byte(val)); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(e), nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user