Documentation
¶
Index ¶
- Constants
- Variables
- func CanAccessDirectory(serv *Server) bool
- func FileServer(r chi.Router, path string, root http.FileSystem)
- func GenPhotoID(f io.ReadSeeker) (string, error)
- func GetDeleted(r *http.Request) (bool, error)
- func GetExif(out chan *exif.Exif, data io.Reader, wg ProcessorWaitGroup, errs chan error)
- func GetPaginateValues(r *http.Request) (int, int, error)
- func GetTag(r *http.Request) string
- func NotFound(w http.ResponseWriter, r *http.Request)
- func ProcessPhoto(input io.Reader, id string, photoPath string, thumbPath string, ...) (*exif.Exif, *image.Rectangle, error)
- func SaveImage(data io.Reader, path string, wg ProcessorWaitGroup, errs chan error)
- func SaveThumb(r chan *image.Rectangle, data io.Reader, path string, wg ProcessorWaitGroup, ...)
- func WriteError(s string, status int, w http.ResponseWriter)
- func WriteJsonResponse(v interface{}, status int, w http.ResponseWriter)
- type DeletePhotoResponse
- type DeleteTagResponse
- type ErrorResponse
- type ExifData
- type GetPagesResponse
- type GetPhotoIDsResponse
- type GetPhotoMetadataResponse
- type GetPhotosResponse
- type GetTagsResponse
- type NotFoundResponse
- type Photo
- type PhotoDB
- type PhotoQuery
- type PostPhotoResponse
- type PostTagResponse
- type ProcessorWaitGroup
- type Server
- func (s *Server) DeletePhoto(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteTag(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetImage(imageFormat string, w http.ResponseWriter, r *http.Request)
- func (s *Server) GetPages(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetPhoto(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetPhotoFromDatabase(photoID string) (Photo, error)
- func (s *Server) GetPhotoIDs(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetPhotoMetadata(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetPhotos(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetTags(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetThumbnail(w http.ResponseWriter, r *http.Request)
- func (s *Server) PhotoCtx(next http.Handler) http.Handler
- func (s *Server) PostPhoto(w http.ResponseWriter, r *http.Request)
- func (s *Server) PostTag(w http.ResponseWriter, r *http.Request)
- func (s *Server) Run()
- func (s *Server) Setup() error
- func (s *Server) TagCtx(next http.Handler) http.Handler
- type Status
- type TagMatcher
Constants ¶
View Source
const MaxHeight = 256
View Source
const MaxWidth = 256
View Source
const (
PageSize = 20
)
View Source
const ProcessingTimeout = 5
Variables ¶
View Source
var ( TagExists = errors.New("tag already exists") TagNotExist = errors.New("tag does not exist") )
Functions ¶
func CanAccessDirectory ¶
func FileServer ¶
func FileServer(r chi.Router, path string, root http.FileSystem)
FileServer conveniently sets up a http.FileServer handler to serve static files from a http.FileSystem.
func GenPhotoID ¶
func GenPhotoID(f io.ReadSeeker) (string, error)
func ProcessPhoto ¶
func SaveImage ¶
func SaveImage(data io.Reader, path string, wg ProcessorWaitGroup, errs chan error)
func WriteError ¶
func WriteError(s string, status int, w http.ResponseWriter)
func WriteJsonResponse ¶
func WriteJsonResponse(v interface{}, status int, w http.ResponseWriter)
Types ¶
type DeletePhotoResponse ¶
type DeleteTagResponse ¶
type ErrorResponse ¶
type GetPagesResponse ¶
type GetPhotoIDsResponse ¶
type GetPhotosResponse ¶
type GetTagsResponse ¶
type NotFoundResponse ¶
type Photo ¶
type Photo struct { ID string `storm:"id" json:"id"` Deleted bool `storm:"index" json:"deleted"` // CANNOT BE OMITTED IN JSON BECAUSE STORM UploadedAt *time.Time `storm:"index" json:"uploaded_at"` TakenAt *time.Time `storm:"index" json:"taken_at"` Width int `storm:"index" json:"width"` Height int `storm:"index" json:"height"` Megapixels float64 `storm:"index" json:"megapixels"` Lat float64 `json:"lat"` Long float64 `json:"long"` CamSerial string `storm:"index" json:"cam_serial"` CamMake string `storm:"index" json:"cam_make"` CamModel string `storm:"index" json:"cam_model"` Status Status `storm:"index" json:"status"` StatusUpdatedAt *time.Time `storm:"index" json:"status_updated_at"` Tags []string `storm:"index" json:"tags"` // not performant, but I don't care }
func (*Photo) UpdateStatus ¶
type PhotoDB ¶
type PhotoDB interface { All(to interface{}, options ...func(*index.Options)) error Count(data interface{}) (int, error) DeleteStruct(data interface{}) error Find(fieldName string, value interface{}, to interface{}, options ...func(q *index.Options)) error Init(data interface{}) error One(fieldName string, value interface{}, to interface{}) error Save(data interface{}) error Select(matchers ...q.Matcher) storm.Query UpdateField(data interface{}, fieldName string, value interface{}) error Update(data interface{}) error }
type PhotoQuery ¶
type PhotoQuery interface { Skip(int) PhotoQuery Limit(int) PhotoQuery OrderBy(...string) PhotoQuery }
type PostPhotoResponse ¶
type PostTagResponse ¶
type ProcessorWaitGroup ¶
type ProcessorWaitGroup interface { Add(delta int) Done() Wait() }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
* Server struct
func (*Server) DeletePhoto ¶
func (s *Server) DeletePhoto(w http.ResponseWriter, r *http.Request)
func (*Server) GetPhotoFromDatabase ¶
func (*Server) GetPhotoIDs ¶
func (s *Server) GetPhotoIDs(w http.ResponseWriter, r *http.Request)
func (*Server) GetPhotoMetadata ¶
func (s *Server) GetPhotoMetadata(w http.ResponseWriter, r *http.Request)
func (*Server) GetThumbnail ¶
func (s *Server) GetThumbnail(w http.ResponseWriter, r *http.Request)
type TagMatcher ¶
type TagMatcher struct {
// contains filtered or unexported fields
}
func (*TagMatcher) MatchField ¶
func (m *TagMatcher) MatchField(v interface{}) (bool, error)
Click to show internal directories.
Click to hide internal directories.