Documentation
¶
Index ¶
- Constants
- Variables
- func CleanPath(prefix string) string
- func ContentTypeFor(key string) string
- func ExtensionFor(kind string) string
- func SafeName(name string) string
- func Sign(secret, key string, expires time.Time) string
- func Sniff(head []byte) string
- func ValidSignature(secret, key, expires, signature string, maxAge time.Duration) bool
- type File
- type HandlerOptions
- type Options
- type Ref
- func (r Ref) Committed() bool
- func (r Ref) Digest() string
- func (r Ref) Empty() bool
- func (r Ref) Extension() string
- func (Ref) GormDataType() string
- func (Ref) IsFile() bool
- func (r *Ref) Scan(value any) error
- func (r Ref) Staged() bool
- func (r Ref) String() string
- func (r Ref) Trashed() bool
- func (r Ref) Value() (driver.Value, error)
- type Rules
- type Service
- func (s *Service) Accept(r *http.Request, field string) (File, error)
- func (s *Service) AcceptTo(r *http.Request, field, path string) (File, error)
- func (s *Service) Commit(ctx context.Context, refs ...*Ref) error
- func (s *Service) Delete(ctx context.Context, ref Ref) error
- func (s *Service) Each(r *http.Request, fn func(part *multipart.Part) error) error
- func (s *Service) Handler(opts HandlerOptions) http.Handler
- func (s *Service) Open(ctx context.Context, ref Ref) (io.ReadSeekCloser, error)
- func (s *Service) Path() string
- func (s *Service) PathFor(field string) string
- func (s *Service) Rules() Rules
- func (s *Service) SignedURL(prefix, secret string, ref Ref, lifetime time.Duration) string
- func (s *Service) Storage() storage.Storage
- func (s *Service) Store(ctx context.Context, r io.Reader, name, declared string, size int64) (File, error)
- func (s *Service) StoreTo(ctx context.Context, r io.Reader, name, declared string, size int64, ...) (File, error)
- func (s *Service) Sweep(ctx context.Context) (staged int, trashed int, err error)
- func (s *Service) URL(prefix string, ref Ref) string
Constants ¶
View Source
const ( StagedPrefix = "staged" TrashPrefix = "trash" )
Variables ¶
View Source
var ( ErrTooLarge = errors.New("coyote/upload: file is larger than the limit") ErrTypeNotAllow = errors.New("coyote/upload: file type is not allowed") ErrTypeMismatch = errors.New("coyote/upload: declared type does not match the content") ErrEmptyFile = errors.New("coyote/upload: file is empty") ErrTooManyPixel = errors.New("coyote/upload: image dimensions are too large") )
View Source
var ( ErrNoFile = errors.New("coyote/upload: no file in the request") ErrNotConfigued = errors.New("coyote/upload: no storage configured") )
Functions ¶
func ContentTypeFor ¶
func ExtensionFor ¶
Types ¶
type HandlerOptions ¶
Click to show internal directories.
Click to hide internal directories.