Documentation
¶
Overview ¶
Package document contains structures for representing the documents stored in a Protavo database.
Index ¶
- func GetStringContent(m proto.Message) string
- func StringContent(s string) proto.Message
- type Document
- type Headers
- type KeyType
- type Keys
- type StringContentType
- func (*StringContentType) Descriptor() ([]byte, []int)
- func (m *StringContentType) GetValue() string
- func (*StringContentType) ProtoMessage()
- func (m *StringContentType) Reset()
- func (m *StringContentType) String() string
- func (m *StringContentType) XXX_DiscardUnknown()
- func (m *StringContentType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *StringContentType) XXX_Merge(src proto.Message)
- func (m *StringContentType) XXX_Size() int
- func (m *StringContentType) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStringContent ¶
GetStringContent returns the string value of a message created with StringContent().
func StringContent ¶
StringContent is a convenience function that returns a Protocol Buffers message that contains a single string.
It be used to easily store plain string content inside a document. The string can be retreived with GetStringContent().
Types ¶
type Document ¶
type Document struct { // ID is the document's unique identifier. It can be any non-empty string. ID string // Keys is the set of indexing keys applied to the document. Keys are used // to quickly find a document or set of documents based on identifiers // other than the document ID. Keys Keys // Headers is an arbitrary set of key/value pairs that is persisted along // with the document content. Headers Headers // Content is the application-defined document content. Content proto.Message // Revision is the version of the document as represented by this value. // When modifying a document, it must be equal to the revision of the document // that is currently persisted, otherwise an OptimisticLockError occurs. Revision uint64 // CreatedAt is the time at which the document was created. The value is // set automatically when the document is saved for the first time. CreatedAt time.Time // UpdatedAt is the time at which the document was last modified. The value // is set automatically when the document is saved. UpdatedAt time.Time }
Document is a document stored in a DB.
func (*Document) KeysByType ¶
KeysByType returns the subset of the document's keys that are of the given type.
func (*Document) SharedKeys ¶
SharedKeys returns the document's shared indexing keys.
func (*Document) UniqueKeys ¶
UniqueKeys returns the document's unique indexing keys.
type KeyType ¶
type KeyType int32
KeyType is an enumeration of the different types of document keys.
const ( // UniqueKey is the KeyType for keys that are always exclusive to a single document. // Uniqye keys are useful for addressing specific documents by some role they // fill or property they hold. UniqueKey KeyType = 1 // Shared keys are useful for quickly locating sets of related documents. SharedKey KeyType = 2 )
type Keys ¶
Keys is a map of key name to type.
func SharedKeys ¶
SharedKeys is a convenience function for creating a key-map consisting of a set of shared keys.
func UniqueKeys ¶
UniqueKeys is a convenience function for creating a key-map consisting of a set of unique keys.
type StringContentType ¶
type StringContentType struct { Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*StringContentType) Descriptor ¶
func (*StringContentType) Descriptor() ([]byte, []int)
func (*StringContentType) GetValue ¶
func (m *StringContentType) GetValue() string
func (*StringContentType) ProtoMessage ¶
func (*StringContentType) ProtoMessage()
func (*StringContentType) Reset ¶
func (m *StringContentType) Reset()
func (*StringContentType) String ¶
func (m *StringContentType) String() string
func (*StringContentType) XXX_DiscardUnknown ¶
func (m *StringContentType) XXX_DiscardUnknown()
func (*StringContentType) XXX_Marshal ¶
func (m *StringContentType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*StringContentType) XXX_Merge ¶
func (dst *StringContentType) XXX_Merge(src proto.Message)
func (*StringContentType) XXX_Size ¶
func (m *StringContentType) XXX_Size() int
func (*StringContentType) XXX_Unmarshal ¶
func (m *StringContentType) XXX_Unmarshal(b []byte) error