Documentation ¶
Overview ¶
Package entity provides types that mirror database tables.
Index ¶
- type Account
- type Attachment
- type BaseEntity
- type BaseEntityObfuscated
- type Block
- type Document
- type DocumentMeta
- type DocumentMetaEditor
- type DocumentMetaViewer
- type DocumentSearch
- type FolderType
- type FolderVisibility
- type Label
- type LabelRole
- type Link
- type LinkCandidate
- type Organization
- type Page
- type PageMeta
- type Pin
- type Revision
- type Search
- type SiteMeta
- type SitemapDocument
- type Template
- type TemplateType
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { BaseEntity Admin bool `json:"admin"` Editor bool `json:"editor"` UserID string `json:"userId"` OrgID string `json:"orgId"` Company string `json:"company"` Title string `json:"title"` Message string `json:"message"` Domain string `json:"domain"` }
Account links a User to an Organization.
type Attachment ¶
type Attachment struct { BaseEntity OrgID string `json:"orgId"` DocumentID string `json:"documentId"` Job string `json:"job"` FileID string `json:"fileId"` Filename string `json:"filename"` Data []byte `json:"-"` Extension string `json:"extension"` }
Attachment represents an attachment to a document.
type BaseEntity ¶
type BaseEntity struct { ID uint64 `json:"-"` RefID string `json:"id"` Created time.Time `json:"created"` Revised time.Time `json:"revised"` }
BaseEntity contains the database fields used in every table.
type BaseEntityObfuscated ¶
type BaseEntityObfuscated struct { ID uint64 `json:"-"` RefID string `json:"-"` Created time.Time `json:"-"` Revised time.Time `json:"-"` }
BaseEntityObfuscated is a mirror of BaseEntity, but with the fields invisible to JSON.
type Block ¶ added in v0.40.0
type Block struct { BaseEntity OrgID string `json:"orgId"` LabelID string `json:"folderId"` UserID string `json:"userId"` ContentType string `json:"contentType"` PageType string `json:"pageType"` Title string `json:"title"` Body string `json:"body"` Excerpt string `json:"excerpt"` RawBody string `json:"rawBody"` // a blob of data Config string `json:"config"` // JSON based custom config for this type ExternalSource bool `json:"externalSource"` // true indicates data sourced externally Used uint64 `json:"used"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` }
Block represents a section that has been published as a reusable content block.
type Document ¶
type Document struct { BaseEntity OrgID string `json:"orgId"` LabelID string `json:"folderId"` UserID string `json:"userId"` Job string `json:"job"` Location string `json:"location"` Title string `json:"name"` Excerpt string `json:"excerpt"` Slug string `json:"-"` Tags string `json:"tags"` Template bool `json:"template"` Layout string `json:"layout"` }
Document represents a document.
func (*Document) SetDefaults ¶
func (d *Document) SetDefaults()
SetDefaults ensures on blanks and cleans.
type DocumentMeta ¶
type DocumentMeta struct { Viewers []DocumentMetaViewer `json:"viewers"` Editors []DocumentMetaEditor `json:"editors"` }
DocumentMeta details who viewed the document.
type DocumentMetaEditor ¶
type DocumentMetaEditor struct { PageID string `json:"pageId"` UserID string `json:"userId"` Action string `json:"action"` Created time.Time `json:"created"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` }
DocumentMetaEditor contains the "edit" metatdata content.
type DocumentMetaViewer ¶
type DocumentMetaViewer struct { UserID string `json:"userId"` Created time.Time `json:"created"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` }
DocumentMetaViewer contains the "view" metatdata content.
type DocumentSearch ¶
type DocumentSearch struct { ID string `json:"id"` DocumentID string `json:"documentId"` DocumentTitle string `json:"documentTitle"` DocumentSlug string `json:"documentSlug"` DocumentExcerpt string `json:"documentExcerpt"` Tags string `json:"documentTags"` PageTitle string `json:"pageTitle"` LabelID string `json:"folderId"` LabelName string `json:"folderName"` FolderSlug string `json:"folderSlug"` }
DocumentSearch represents 'presentable' search results.
type FolderType ¶
type FolderType int
FolderType determines folder visibility.
const ( // FolderTypePublic can be seen by anyone FolderTypePublic FolderType = 1 // FolderTypePrivate can only be seen by the person who owns it FolderTypePrivate FolderType = 2 // FolderTypeRestricted can be seen by selected users FolderTypeRestricted FolderType = 3 )
type FolderVisibility ¶
type FolderVisibility struct { Name string `json:"name"` LabelID string `json:"folderId"` Type int `json:"folderType"` UserID string `json:"userId"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` Email string `json:"email"` }
FolderVisibility details who can see a particular folder
type Label ¶
type Label struct { BaseEntity Name string `json:"name"` OrgID string `json:"orgId"` UserID string `json:"userId"` Type FolderType `json:"folderType"` }
Label defines a container for documents.
func (*Label) IsRestricted ¶
IsRestricted means the folder can be seen by selected users.
type LabelRole ¶
type LabelRole struct { BaseEntityObfuscated OrgID string `json:"-"` LabelID string `json:"folderId"` UserID string `json:"userId"` CanView bool `json:"canView"` CanEdit bool `json:"canEdit"` }
LabelRole determines user permissions for a folder.
type Link ¶ added in v0.28.0
type Link struct { BaseEntity OrgID string `json:"orgId"` FolderID string `json:"folderId"` UserID string `json:"userId"` LinkType string `json:"linkType"` SourceDocumentID string `json:"sourceDocumentId"` SourcePageID string `json:"sourcePageId"` TargetDocumentID string `json:"targetDocumentId"` TargetID string `json:"targetId"` Orphan bool `json:"orphan"` }
Link defines a reference between a section and another document/section/attachment.
type LinkCandidate ¶ added in v0.28.0
type LinkCandidate struct { RefID string `json:"id"` LinkType string `json:"linkType"` FolderID string `json:"folderId"` DocumentID string `json:"documentId"` TargetID string `json:"targetId"` Title string `json:"title"` // what we label the link Context string `json:"context"` // additional context (e.g. excerpt, parent, file extension) }
LinkCandidate defines a potential link to a document/section/attachment.
type Organization ¶
type Organization struct { BaseEntity Company string `json:"-"` Title string `json:"title"` Message string `json:"message"` URL string `json:"url"` Domain string `json:"domain"` Email string `json:"email"` AllowAnonymousAccess bool `json:"allowAnonymousAccess"` Serial string `json:"-"` Active bool `json:"-"` }
Organization defines a company that uses this app.
type Page ¶
type Page struct { BaseEntity OrgID string `json:"orgId"` DocumentID string `json:"documentId"` UserID string `json:"userId"` ContentType string `json:"contentType"` PageType string `json:"pageType"` BlockID string `json:"blockId"` Level uint64 `json:"level"` Sequence float64 `json:"sequence"` Title string `json:"title"` Body string `json:"body"` Revisions uint64 `json:"revisions"` }
Page represents a section within a document.
func (*Page) IsSectionType ¶ added in v0.31.0
IsSectionType tells us that page is "words"
type PageMeta ¶
type PageMeta struct { ID uint64 `json:"id"` Created time.Time `json:"created"` Revised time.Time `json:"revised"` OrgID string `json:"orgId"` UserID string `json:"userId"` DocumentID string `json:"documentId"` PageID string `json:"pageId"` RawBody string `json:"rawBody"` // a blob of data Config string `json:"config"` // JSON based custom config for this type ExternalSource bool `json:"externalSource"` // true indicates data sourced externally }
PageMeta holds raw page data that is used to render the actual page data.
func (*PageMeta) SetDefaults ¶
func (p *PageMeta) SetDefaults()
SetDefaults ensures no blank values.
type Pin ¶ added in v0.34.0
type Pin struct { BaseEntity OrgID string `json:"orgId"` UserID string `json:"userId"` FolderID string `json:"folderId"` DocumentID string `json:"documentId"` Pin string `json:"pin"` Sequence int `json:"sequence"` }
Pin defines a saved link to a document or space
type Revision ¶ added in v0.35.0
type Revision struct { BaseEntity OrgID string `json:"orgId"` DocumentID string `json:"documentId"` PageID string `json:"pageId"` OwnerID string `json:"ownerId"` UserID string `json:"userId"` ContentType string `json:"contentType"` PageType string `json:"pageType"` Title string `json:"title"` Body string `json:"body"` RawBody string `json:"rawBody"` Config string `json:"config"` Email string `json:"email"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` Initials string `json:"initials"` Revisions int `json:"revisions"` }
Revision holds the previous version of a Page.
type Search ¶
type Search struct { ID string `json:"id"` Created time.Time `json:"created"` Revised time.Time `json:"revised"` OrgID string DocumentID string Level uint64 Sequence float64 DocumentTitle string Slug string PageTitle string Body string }
Search holds raw search results.
type SiteMeta ¶
type SiteMeta struct { OrgID string `json:"orgId"` Title string `json:"title"` Message string `json:"message"` URL string `json:"url"` AllowAnonymousAccess bool `json:"allowAnonymousAccess"` Version string `json:"version"` }
SiteMeta holds information associated with an Organization.
type SitemapDocument ¶
type SitemapDocument struct { DocumentID string Document string FolderID string Folder string Revised time.Time }
SitemapDocument details a document that can be exposed via Sitemap.
type Template ¶
type Template struct { ID string `json:"id"` Title string `json:"title"` Description string `json:"description"` Author string `json:"author"` Type TemplateType `json:"type"` Dated time.Time `json:"dated"` }
Template is used to create a new document. Template can consist of content, attachments and have associated meta data indentifying author, version contact details and more.
func (*Template) IsRestricted ¶
IsRestricted means selected users can see the template.
type TemplateType ¶
type TemplateType int
TemplateType determines who can see a template.
const ( // TemplateTypePublic means anyone can see the template. TemplateTypePublic TemplateType = 1 // TemplateTypePrivate means only the owner can see the template. TemplateTypePrivate TemplateType = 2 // TemplateTypeRestricted means selected users can see the template. TemplateTypeRestricted TemplateType = 3 )
type User ¶
type User struct { BaseEntity Firstname string `json:"firstname"` Lastname string `json:"lastname"` Email string `json:"email"` Initials string `json:"initials"` Active bool `json:"active"` Editor bool `json:"editor"` Admin bool `json:"admin"` Global bool `json:"global"` Password string `json:"-"` Salt string `json:"-"` Reset string `json:"-"` Accounts []Account `json:"accounts"` }
User defines a login.
func (*User) ProtectSecrets ¶
func (user *User) ProtectSecrets()
ProtectSecrets blanks sensitive data.