-
Notifications
You must be signed in to change notification settings - Fork 7
/
Resource.go
38 lines (31 loc) · 1.17 KB
/
Resource.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package resource
// Properties describe the meta information about a resource.
type Properties struct {
// Compound tells whether the resource should be serialized with a directory.
// Compound resources can have zero, one, or more blocks.
// Simple resources always have exactly one block.
Compound bool
// ContentType describes how the block data shall be interpreted.
ContentType ContentType
// Compressed tells whether the data shall be serialized in compressed form.
Compressed bool
}
// Resource provides meta information as well as access to its contained blocks.
type Resource struct {
Properties
Blocks
}
// Compound tells whether the resource should be serialized with a directory.
// Compound resources can have zero, one, or more blocks.
// Simple resources always have exactly one block.
func (res Resource) Compound() bool {
return res.Properties.Compound
}
// ContentType describes how the block data shall be interpreted.
func (res Resource) ContentType() ContentType {
return res.Properties.ContentType
}
// Compressed tells whether the data shall be serialized in compressed form.
func (res Resource) Compressed() bool {
return res.Properties.Compressed
}