docs

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const VisTokenAll = "*"

VisTokenAll is the placeholder token value representing "all" tokens. It should exist on all every entity. Its value is picked to specifically to be not a valid slug so that it wouldn't conflict with any created token ids.

View Source
const VisTokenPublic = "#P"

VisTokenPublic is the virtual token id representing public access (there is no actual VisibilityToken corresponding to this id) Its value is picked to specifically to be not a valid slug so that it wouldn't conflict with any created token ids.

Variables

This section is empty.

Functions

func IsValidVisTokenID added in v0.11.0

func IsValidVisTokenID(id string) bool

IsValidVisTokenID checks if the id is a valid visibility token id

Types

type CategoryEntry

type CategoryEntry struct {
	GroupBase `bson:",inline" json:",inline"`
}

CategoryEntry is the structure of a category document, which includes categories and category values

type Date

type Date struct {
	GroupBase `bson:",inline" json:",inline"`
}

Date is the structure of a date document

type Folder

type Folder struct {
	GroupBase `bson:",inline" json:",inline"`
	// SelfVisTokens are tokens explicitly put on this folder
	SelfVisTokens []string `bson:"selfVisTokens" json:"selfVisTokens,omitempty"`
}

Folder is the structure of a folder document

type GeoJSONPoint

type GeoJSONPoint struct {
	Type        string    `bson:"type" json:"-"`
	Coordinates []float64 `bson:"coordinates" json:"coordinates"`
}

GeoJSONPoint represents a MongoDB GeoJSON point Designed to be added to MongoDB as a document

func NewGeoJSONPoint

func NewGeoJSONPoint(latitude float64, longitude float64) *GeoJSONPoint

NewGeoJSONPoint creates a new GeoJSONPoint object

func (*GeoJSONPoint) GetLatitude

func (pt *GeoJSONPoint) GetLatitude() float64

GetLatitude returns the latitude component of the point

func (*GeoJSONPoint) GetLongitude

func (pt *GeoJSONPoint) GetLongitude() float64

GetLongitude returns the longitude component of the point

func (*GeoJSONPoint) SetLatitude

func (pt *GeoJSONPoint) SetLatitude(latitude float64)

SetLatitude sets the latitude component of the point

func (*GeoJSONPoint) SetLongitude

func (pt *GeoJSONPoint) SetLongitude(longitude float64)

SetLongitude sets the longitude component of the point

type GroupBase

type GroupBase struct {
	ID         *string          `bson:"_id" json:"id,omitempty"`                        // slug path
	Timestamp  *time.Time       `bson:"timestamp,omitempty" json:"timestamp,omitempty"` // last time something was added or modified belonging to the group
	Display    *string          `bson:"display,omitempty" json:"display,omitempty"`     // display path
	Depth      *int             `bson:"depth,omitempty" json:"depth,omitempty"`
	SortOrder  *int             `bson:"sortOrder,omitempty" json:"sortOrder,omitempty"`
	CoverPhoto *GroupCoverPhoto `bson:"coverPhoto,omitempty" json:"coverPhoto,omitempty"`

	// Visibility tokens should never be nil. At least an empty array.
	VisTokens          []string       `bson:"visTokens" json:"visTokens,omitempty"`
	VisTokenCounts     map[string]int `bson:"visTokenCounts" json:"visTokenCounts,omitempty"`
	DescVisTokenCounts map[string]int `bson:"descVisTokenCounts" json:"descVisTokenCounts,omitempty"`
}

GroupBase defines the base fields for a grouping collection. Should be embedded in the overall group-specific document with bson:",inline" and json:",inline".

type GroupCoverPhoto added in v0.11.0

type GroupCoverPhoto struct {
	Photo            *PhotoID   `bson:"photo,omitempty" json:"photo,omitempty"`
	UserSelected     *bool      `bson:"userSelected,omitempty" json:"userSelected,omitempty"`
	LastAutoSelected *time.Time `bson:"lastAutoSelected,omitempty" json:"lastAutoSelected,omitempty"`
}

GroupCoverPhoto describes the current cover photo for a group

type Keyword

type Keyword struct {
	GroupBase `bson:",inline" json:",inline"`
}

Keyword is the structure of a keyword document

type Location

type Location struct {
	GroupBase `bson:",inline" json:",inline"`
}

Location is the structure of a location document

type Photo

type Photo struct {
	ID          *PhotoID   `bson:"_id" json:"id,omitempty"`
	SortKey     *string    `bson:"sortKey" json:"sortKey,omitempty"`
	StoreBucket *string    `bson:"storeBucket" json:"storeBucket,omitempty"`
	StoreObject *string    `bson:"storeObject" json:"storeObject,omitempty"`
	StoreGen    *string    `bson:"storeGen" json:"storeGen,omitempty"` // base64 encoded
	FileSize    *int       `bson:"fileSize" json:"fileSize,omitempty"`
	Folder      *string    `bson:"folder" json:"folder,omitempty"` // slug
	Width       *int       `bson:"width" json:"width,omitempty"`
	Height      *int       `bson:"height" json:"height,omitempty"`
	Timestamp   *time.Time `bson:"timestamp" json:"timestamp,omitempty"`
	TsSortKey   *string    `bson:"tsSortKey" json:"tsSortKey,omitempty"`
	Date        *string    `bson:"date" json:"date,omitempty"`

	// A photo either inherits its folder's visibility or has its own visibility tokens
	InheritVisibility *bool `bson:"inheritVisibility,omitempty" json:"inheritVisibility,omitempty"`

	// VisTokens control visibility and account for photo self-visibility and folder visibility.
	// In BSON, don't use omitempty as this field should never be nil (at least an empty array).
	VisTokens []string `bson:"visTokens" json:"visTokens,omitempty"`

	// Optional metadata
	Title       *string    `bson:"title,omitempty" json:"title,omitempty"`
	Description *string    `bson:"description,omitempty" json:"description,omitempty"`
	Keywords    []string   `bson:"keywords,omitempty" json:"keywords,omitempty"`     // slugs
	Categories  []string   `bson:"categories,omitempty" json:"categories,omitempty"` // slugs
	DateTime    *time.Time `bson:"dateTime,omitempty" json:"dateTime,omitempty"`
	Rating      *int32     `bson:"rating,omitempty" json:"rating,omitempty"`

	Copyright   *string `bson:"copyright,omitempty" json:"copyright,omitempty"`
	UsageTerms  *string `bson:"usageTerms,omitempty" json:"usageTerms,omitempty"`
	UsageWebURL *string `bson:"usageWebUrl,omitempty" json:"usageWebUrl,omitempty"`

	Location    *string       `bson:"location,omitempty" json:"location,omitempty"` // slug
	GPSLocation *GeoJSONPoint `bson:"gpsLocation,omitempty" json:"gpsLocation,omitempty"`
	GPSAltitude *float64      `bson:"gpsAltitude,omitempty" json:"gpsAltitude,omitempty"`

	Make         *string  `bson:"make,omitempty" json:"make,omitempty"`
	Model        *string  `bson:"model,omitempty" json:"model,omitempty"`
	Lens         *string  `bson:"lens,omitempty" json:"lens,omitempty"`
	FNumber      *float64 `bson:"fNumber,omitempty" json:"fNumber,omitempty"`
	FocalLength  *float64 `bson:"focalLength,omitempty" json:"focalLength,omitempty"`
	ISO          *int32   `bson:"iso,omitempty" json:"iso,omitempty"`
	ExposureTime *float64 `bson:"exposureTime,omitempty" json:"exposureTime,omitempty"`
	ExposureBias *float64 `bson:"exposureBias,omitempty" json:"exposureBias,omitempty"`
}

Photo is the structure of a folder document

type PhotoID

type PhotoID string

PhotoID is the id type for a photo document

type PhotoResizeCacheEntry

type PhotoResizeCacheEntry struct {
	PhotoTimestamp time.Time `bson:"photoTimestamp"`
	FileSize       int       `bson:"fileSize"`
	LastAccess     time.Time `bson:"lastAccess"`
	CacheHit       int       `bson:"cacheHit"`
}

PhotoResizeCacheEntry is the embedded document structure for one cache entry

type Session

type Session struct {
	ID     SessionID `bson:"_id"`
	UserID UserID    `bson:"userId"`
	Expiry time.Time `bson:"expiry"`
}

Session stores info about a logged-in session

type SessionID

type SessionID string

SessionID is the type of a session id

type User

type User struct {
	ID             *UserID   `bson:"_id" json:"id,omitempty"`
	HashedPassword *string   `bson:"hashedPassword" json:"-"`
	Role           *UserRole `bson:"role" json:"role,omitempty"`
}

User is the document type for a user

type UserID

type UserID string

UserID is the id type for a user document

type UserRole

type UserRole string

UserRole type

const UserRoleAdmin UserRole = "admin"

UserRoleAdmin role

type VisibilityToken

type VisibilityToken struct {
	GroupBase `bson:",inline"`
	Links     []VisibilityTokenLink `bson:"links,omitempty" json:"links,omitempty"`
}

VisibilityToken describes a visibility token

type VisibilityTokenLink struct {
	// Cryptographically-secure activation value
	ActivationValue *string `bson:"activationValue,omitempty" json:"activationValue,omitempty"`
	ActivationCount *int    `bson:"activationCount,omitempty" json:"activationCount,omitempty"`
	Redirect        *string `bson:"redirect,omitempty" json:"redirect,omitempty"`
	Comment         *string `bson:"comment,omitempty" json:"comment,omitempty"`
	Disabled        *bool   `bson:"disabled,omitempty" json:"disabled,omitempty"`
}

VisibilityTokenLink describes a link for a token

Jump to

Keyboard shortcuts

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