entities

package
v0.0.0-...-4314f45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2024 License: BSD-3-Clause Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FmtBytes

func FmtBytes(size float64) string

FmtBytes converts the numeric byte size value to the appropriate magnitude size in KB, MB, GB, TB, PB, or EB.

func FmtTime

func FmtTime(t int64) string

FmtTime shows a human-readable time based on the timestamp

Types

type AnalyticsHTTPRequestMetadata

type AnalyticsHTTPRequestMetadata struct {
	URL        string `json:"url"`
	Method     string `json:"http_method"`
	Origin     string `json:"origin"`
	Proto      string `json:"http_protocol"`
	RemoteAddr string `json:"ip_address"`
	Timestamp  int64  `json:"timestamp"`
	External   bool   `json:"external_content"`
}

type AnalyticsMetric

type AnalyticsMetric struct {
	Date   string `json:"date"`
	Total  int    `json:"total"`
	Unique int    `json:"unique"`
}

type AuthToken

type AuthToken struct {
	Expires time.Time
	Token   string
}

type Config

type Config struct {
	item.Item

	Name                    string   `json:"name"`
	Domain                  string   `json:"domain"`
	BindAddress             string   `json:"bind_addr"`
	HTTPPort                string   `json:"http_port"`
	HTTPSPort               string   `json:"https_port"`
	AdminEmail              string   `json:"admin_email"`
	ClientSecret            string   `json:"client_secret"`
	Etag                    string   `json:"etag"`
	DisableCORS             bool     `json:"cors_disabled"`
	DisableGZIP             bool     `json:"gzip_disabled"`
	DisableHTTPCache        bool     `json:"cache_disabled"`
	CacheMaxAge             int64    `json:"cache_max_age"`
	CacheInvalidate         []string `json:"cache"`
	BackupBasicAuthUser     string   `json:"backup_basic_auth_user"`
	BackupBasicAuthPassword string   `json:"backup_basic_auth_password"`
}

Config represents the configurable options of the system

func (*Config) MarshalEditor

func (c *Config) MarshalEditor(paths config.Paths) ([]byte, error)

MarshalEditor writes a buffer of templates to edit a Post and partially implements editor.Editable

func (*Config) String

func (c *Config) String() string

String partially implements item.Identifiable and overrides Item's String()

type Credential

type Credential struct {
	Type CredentialType `json:"type"`
	// TODO: value should be an interface. supporting many credential value types
	Value string `json:"value"`
}

type CredentialHash

type CredentialHash struct {
	UserId string         `json:"user_id"`
	Type   CredentialType `json:"type"`
	Value  []byte         `json:"value"`
}

type CredentialType

type CredentialType string
var CredentialTypePassword CredentialType = "password"

type FileUpload

type FileUpload struct {
	item.Item

	Name          string `json:"name"`
	Path          string `json:"path"`
	ContentLength int64  `json:"content_length"`
	ContentType   string `json:"content_type"`
}

FileUpload represents the file uploaded to the system

func (*FileUpload) GetSearchableAttributes

func (f *FileUpload) GetSearchableAttributes() map[string]reflect.Type

GetSearchableAttributes defines fields that should be indexed

func (*FileUpload) IndexContent

func (f *FileUpload) IndexContent() bool

IndexContent determines if FileUpload should be indexed for searching

func (*FileUpload) MarshalEditor

func (f *FileUpload) MarshalEditor(paths config.Paths) ([]byte, error)

MarshalEditor writes a buffer of templates to edit a Post and partially implements editor.Editable

func (*FileUpload) Push

func (f *FileUpload) Push() []string

func (*FileUpload) String

func (f *FileUpload) String() string

String partially implements item.Identifiable and overrides Item's String()

type Pagination

type Pagination struct {
	Count  int
	Offset int
}

type PasswordHash

type PasswordHash struct {
	Hash string `json:"hash"`
	Salt string `json:"salt"`
}

type ResponseStream

type ResponseStream struct {
	ContentType        string
	ContentDisposition string
	Payload            io.Reader
}
type Search struct {
	Query      string
	SortOrder  constants.SortOrder
	Pagination *Pagination
}

type User

type User struct {
	ID    string `json:"id"`
	Email string `json:"email"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL