Documentation ¶
Index ¶
- Constants
- Variables
- type FileSystemStore
- type Item
- type LevelDBStore
- func (ld *LevelDBStore) Exists(id string) (exists bool, err error)
- func (ld *LevelDBStore) Fetch(id string) (item *Item, err error)
- func (ld *LevelDBStore) Keys(prefixes ...string) (list []string, err error)
- func (ld *LevelDBStore) Remove(id string) (err error)
- func (ld *LevelDBStore) Save(id string, item *Item) (err error)
- type Storage
- func (storage *Storage) Exists(id string) (bool, error)
- func (storage *Storage) Fetch(id string, extension string) (buff bytes.Buffer, mimeType string, err error)
- func (storage *Storage) GenerateID() (id string, err error)
- func (storage *Storage) Keys(prefixes ...string) (list []string, err error)
- func (storage *Storage) ReadMetaData(id string) (item *Item, err error)
- func (storage *Storage) Remove(id string) error
- func (storage *Storage) Save(id string, reader io.Reader, metadata ...map[string]interface{}) (err error)
Constants ¶
View Source
const ( // FileSystem constant value FileSystem = 0 // LevelDB constant value LevelDB = 1 )
Variables ¶
View Source
var ( // ErrUnsupportedMIMEType error value ErrUnsupportedMIMEType = errors.New("unsupported MIME type") // ErrUnsupportedFileExtension error value ErrUnsupportedFileExtension = errors.New("unsupported file extension") // ErrInvalidJSON error value ErrInvalidJSON = errors.New("invalid json") )
Functions ¶
This section is empty.
Types ¶
type FileSystemStore ¶
type FileSystemStore struct {
// contains filtered or unexported fields
}
FileSystemStore structure
func NewFileSystemStore ¶
func NewFileSystemStore() (fs *FileSystemStore)
NewFileSystemStore constructor
func (*FileSystemStore) Exists ¶
func (fs *FileSystemStore) Exists(id string) (exists bool, err error)
Exists method
func (*FileSystemStore) Fetch ¶
func (fs *FileSystemStore) Fetch(id string) (img image.Image, err error)
Fetch method
func (*FileSystemStore) Remove ¶
func (fs *FileSystemStore) Remove(id string) (err error)
Remove method
type Item ¶
type Item struct { Width int `codec:"width" json:"width"` Height int `codec:"height" json:"height"` CreatedAt time.Time `codec:"created_at" json:"created_at"` UpdatedAt time.Time `codec:"updated_at" json:"updated_at"` // 登録者情報 IP string `codec:"ip" json:"-"` UA string `codec:"ua" json:"-"` // 画像データ Webp []byte `codec:"file" json:"-"` // 汎用メタデータ (JSON) for MessagePack MsgpData []byte `codec:"data" json:"-"` // 汎用メタデータ (JSON) for API JSONData map[string]interface{} `codec:"-" json:"data"` }
Item structure for storage
type LevelDBStore ¶
type LevelDBStore struct {
// contains filtered or unexported fields
}
LevelDBStore structure (implement store interface)
func (*LevelDBStore) Exists ¶
func (ld *LevelDBStore) Exists(id string) (exists bool, err error)
Exists method
func (*LevelDBStore) Fetch ¶
func (ld *LevelDBStore) Fetch(id string) (item *Item, err error)
Fetch method
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage structure
func (*Storage) Fetch ¶
func (storage *Storage) Fetch(id string, extension string) (buff bytes.Buffer, mimeType string, err error)
Fetch method
func (*Storage) GenerateID ¶
GenerateID will generate unique file ID
func (*Storage) ReadMetaData ¶
ReadMetaData method
Click to show internal directories.
Click to hide internal directories.