Documentation ¶
Index ¶
- Constants
- type CalUser
- type FileResourceAdapter
- type FileStorage
- func (fs *FileStorage) CreateResource(rpath, content string) (*Resource, error)
- func (fs *FileStorage) DeleteResource(rpath string) error
- func (fs *FileStorage) GetResource(rpath string) (*Resource, bool, error)
- func (fs *FileStorage) GetResources(rpath string, withChildren bool) ([]Resource, error)
- func (fs *FileStorage) GetResourcesByFilters(rpath string, filters *ResourceFilter) ([]Resource, error)
- func (fs *FileStorage) GetResourcesByList(rpaths []string) ([]Resource, error)
- func (fs *FileStorage) GetShallowResource(rpath string) (*Resource, bool, error)
- func (fs *FileStorage) UpdateResource(rpath, content string) (*Resource, error)
- type Resource
- func (r *Resource) ComponentName() string
- func (r *Resource) EndTimeUTC() time.Time
- func (r *Resource) GetContentData() (string, bool)
- func (r *Resource) GetContentLength() (string, bool)
- func (r *Resource) GetContentType() (string, bool)
- func (r *Resource) GetDisplayName() (string, bool)
- func (r *Resource) GetEtag() (string, bool)
- func (r *Resource) GetLastModified(format string) (string, bool)
- func (r *Resource) GetOwner() (string, bool)
- func (r *Resource) GetOwnerPath() (string, bool)
- func (r *Resource) GetPropertyParamValue(paramPath ...string) string
- func (r *Resource) GetPropertyValue(propPath ...string) string
- func (r *Resource) HasProperty(propPath ...string) bool
- func (r *Resource) HasPropertyParam(paramPath ...string) bool
- func (r *Resource) IsCollection() bool
- func (r *Resource) IsPrincipal() bool
- func (r *Resource) Recurrences() []ResourceRecurrence
- func (r *Resource) StartTimeUTC() time.Time
- type ResourceAdapter
- type ResourceFilter
- type ResourceInterface
- type ResourceRecurrence
- type Storage
Constants ¶
View Source
const ( TAG_FILTER = "filter" TAG_COMP_FILTER = "comp-filter" TAG_PROP_FILTER = "prop-filter" TAG_PARAM_FILTER = "param-filter" TAG_TIME_RANGE = "time-range" TAG_TEXT_MATCH = "text-match" TAG_IS_NOT_DEFINED = "is-not-defined" // from the RFC, the time range `start` and `end` attributes MUST be in UTC and in this specific format FILTER_TIME_FORMAT = "20060102T150405Z" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileResourceAdapter ¶
type FileResourceAdapter struct {
// contains filtered or unexported fields
}
func (*FileResourceAdapter) CalculateEtag ¶
func (adp *FileResourceAdapter) CalculateEtag() string
func (*FileResourceAdapter) GetContent ¶
func (adp *FileResourceAdapter) GetContent() string
func (*FileResourceAdapter) GetContentSize ¶
func (adp *FileResourceAdapter) GetContentSize() int64
func (*FileResourceAdapter) GetModTime ¶
func (adp *FileResourceAdapter) GetModTime() time.Time
func (*FileResourceAdapter) IsCollection ¶
func (adp *FileResourceAdapter) IsCollection() bool
type FileStorage ¶
type FileStorage struct { }
FileStorage is the storage that deals with resources as files in the file system. So, a collection resource is treated as a folder/directory and its children resources are the files it contains. On the other hand, non-collection resources are just plain files.
func (*FileStorage) CreateResource ¶
func (fs *FileStorage) CreateResource(rpath, content string) (*Resource, error)
func (*FileStorage) DeleteResource ¶
func (fs *FileStorage) DeleteResource(rpath string) error
func (*FileStorage) GetResource ¶
func (fs *FileStorage) GetResource(rpath string) (*Resource, bool, error)
func (*FileStorage) GetResources ¶
func (fs *FileStorage) GetResources(rpath string, withChildren bool) ([]Resource, error)
func (*FileStorage) GetResourcesByFilters ¶
func (fs *FileStorage) GetResourcesByFilters(rpath string, filters *ResourceFilter) ([]Resource, error)
func (*FileStorage) GetResourcesByList ¶
func (fs *FileStorage) GetResourcesByList(rpaths []string) ([]Resource, error)
func (*FileStorage) GetShallowResource ¶
func (fs *FileStorage) GetShallowResource(rpath string) (*Resource, bool, error)
func (*FileStorage) UpdateResource ¶
func (fs *FileStorage) UpdateResource(rpath, content string) (*Resource, error)
type Resource ¶
func NewResource ¶
func NewResource(resPath string, adp ResourceAdapter) Resource
func (*Resource) ComponentName ¶
func (*Resource) EndTimeUTC ¶
func (*Resource) GetContentData ¶
func (*Resource) GetContentLength ¶
func (*Resource) GetContentType ¶
func (*Resource) GetDisplayName ¶
func (*Resource) GetOwnerPath ¶
func (*Resource) GetPropertyParamValue ¶
func (*Resource) GetPropertyValue ¶
func (*Resource) HasProperty ¶
func (*Resource) HasPropertyParam ¶
func (*Resource) IsCollection ¶
func (*Resource) IsPrincipal ¶
func (*Resource) Recurrences ¶
func (r *Resource) Recurrences() []ResourceRecurrence
func (*Resource) StartTimeUTC ¶
type ResourceAdapter ¶
type ResourceFilter ¶
type ResourceFilter struct {
// contains filtered or unexported fields
}
func ParseResourceFilters ¶
func ParseResourceFilters(xml string) (*ResourceFilter, error)
This function creates a new filter object from a piece of XML string.
func (*ResourceFilter) Attr ¶
func (f *ResourceFilter) Attr(attrName string) string
func (*ResourceFilter) GetTimeRangeFilter ¶
func (f *ResourceFilter) GetTimeRangeFilter() *ResourceFilter
GetTimeRangeFilter checks if the current filter has a child "time-range" filter and returns it (wrapped in a `ResourceFilter` type). It returns nil if the current filter does not contain any "time-range" filter.
func (*ResourceFilter) Match ¶
func (f *ResourceFilter) Match(target ResourceInterface) bool
type ResourceInterface ¶
type ResourceInterface interface { ComponentName() string StartTimeUTC() time.Time EndTimeUTC() time.Time Recurrences() []ResourceRecurrence HasProperty(propPath ...string) bool GetPropertyValue(propPath ...string) string HasPropertyParam(paramName ...string) bool GetPropertyParamValue(paramName ...string) string }
type Storage ¶
type Storage interface { // GetResources gets a list of resources based on a given `rpath`. The // `rpath` is the path to the original resource that's being requested. The resultant list // will/must contain that original resource in it, apart from any additional resources. It also receives // `withChildren` flag to say if the result must also include all the original resource`s // children (if original is a collection resource). If `true`, the result will have the requested resource + children. // If `false`, it will have only the requested original resource (from the `rpath` path). // It returns errors if anything went wrong or if it could not find any resource on `rpath` path. GetResources(rpath string, withChildren bool) ([]Resource, error) // GetResourcesByList fetches a list of resources by path from the storage. // This method fetches all the `rpaths` and return an array of the reosurces found. // No error 404 will be returned if one of the resources cannot be found. // Errors are returned if any errors other than "not found" happens. GetResourcesByList(rpaths []string) ([]Resource, error) // GetResourcesByFilters returns the filtered children of a target collection resource. // The target collection resource is the one pointed by the `rpath` parameter. All of its children // will be checked against a set of `filters` and the matching ones are returned. The results // contains only the filtered children and does NOT include the target resource. If the target resource // is not a collection, an empty array is returned as the result. GetResourcesByFilters(rpath string, filters *ResourceFilter) ([]Resource, error) // GetResource gets the requested resource based on a given `rpath` path. It returns the resource (if found) or // nil (if not found). Also returns a flag specifying if the resource was found or not. GetResource(rpath string) (*Resource, bool, error) // GetShallowResource has the same behaviour of `storage.GetResource`. The only difference is that, for collection resources, // it does not return its children in the collection `storage.Resource` struct (hence the name shallow). The motive is // for optimizations reasons, as this function is used on places where the collection's children are not important. GetShallowResource(rpath string) (*Resource, bool, error) // CreateResource creates a new resource on the `rpath` path with a given `content`. CreateResource(rpath, content string) (*Resource, error) // UpdateResource udpates a resource on the `rpath` path with a given `content`. UpdateResource(rpath, content string) (*Resource, error) // DeleteResource deletes a resource on the `rpath` path. DeleteResource(rpath string) error }
The Storage is the responsible for the CRUD operations on the caldav resources.
Click to show internal directories.
Click to hide internal directories.