Documentation
¶
Index ¶
- Constants
- Variables
- func SetUuidLoader(loader UuidLoader)
- func SetUuidSaver(saver UuidSaver)
- type FileBox
- func FromBase64(encode string, options ...Option) *FileBox
- func FromFile(path string, options ...Option) *FileBox
- func FromJSON(s string) *FileBox
- func FromQRCode(qrCode string, options ...Option) *FileBox
- func FromStream(reader io.Reader, options ...Option) *FileBox
- func FromUrl(urlString string, options ...Option) *FileBox
- func FromUuid(uuid string, options ...Option) *FileBox
- func (fb *FileBox) Error() error
- func (fb *FileBox) Size()
- func (fb *FileBox) String() string
- func (fb *FileBox) ToBase64() (string, error)
- func (fb *FileBox) ToBytes() ([]byte, error)
- func (fb *FileBox) ToDataURL() (string, error)
- func (fb *FileBox) ToFile(filePath string, overwrite bool) error
- func (fb *FileBox) ToJSON() (string, error)
- func (fb *FileBox) ToQRCode() (string, error)
- func (fb *FileBox) ToReader() (io.Reader, error)
- func (fb *FileBox) ToUuid() (string, error)
- func (fb *FileBox) Type() Type
- type Option
- type Options
- type OptionsBase64
- type OptionsCommon
- type OptionsQRCode
- type OptionsUrl
- type OptionsUuid
- type Type
- type UuidLoader
- type UuidSaver
Constants ¶
View Source
const ( TypeUnknown Type = 0 TypeBase64 = 1 TypeUrl = 2 TypeQRCode = 3 TypeBuffer = 4 TypeFile = 5 TypeStream = 6 TypeUuid = 7 )
Variables ¶
View Source
var ( // ErrToJSON err to json ErrToJSON = errors.New("FileBox.toJSON() only support TypeUrl,TypeQRCode,TypeBase64, TypeUuid") // ErrNoBase64Data no base64 data ErrNoBase64Data = errors.New("no Base64 data") // ErrNoUrl no url ErrNoUrl = errors.New("no url") // ErrNoPath no path ErrNoPath = errors.New("no path") // ErrNoQRCode no QR Code ErrNoQRCode = errors.New("no QR Code") // ErrNoUuid no uuid ErrNoUuid = errors.New("no uuid") )
Functions ¶
func SetUuidLoader ¶ added in v0.4.0
func SetUuidLoader(loader UuidLoader)
SetUuidLoader set uuid loader
Types ¶
type FileBox ¶
type FileBox struct { Name string // contains filtered or unexported fields }
FileBox struct
func FromBase64 ¶
FromBase64 create FileBox from Base64
func FromQRCode ¶
FromQRCode create FileBox from QRCode
func FromStream ¶
FromStream from io.Reader
type Option ¶ added in v0.4.0
type Option func(options *Options)
func WithMetadata ¶ added in v0.4.0
WithMetadata set metadata
func WithOptions ¶ added in v0.4.0
type Options ¶
type Options struct { OptionsCommon OptionsBase64 OptionsQRCode OptionsUrl OptionsUuid }
Options ...
type OptionsBase64 ¶
type OptionsBase64 struct {
Base64 string `json:"base64"`
}
OptionsBase64 base64
type OptionsCommon ¶
type OptionsCommon struct { Name string `json:"name"` Metadata map[string]interface{} `json:"metadata"` BoxType Type `json:"type"` // Deprecated BoxTypeDeprecated Type `json:"boxType"` Size int64 `json:"size"` Md5 string `json:"md5"` }
OptionsCommon common options
type OptionsQRCode ¶
type OptionsQRCode struct {
QrCode string `json:"qrCode"`
}
OptionsQRCode QRCode
type OptionsUrl ¶
OptionsUrl url
type OptionsUuid ¶ added in v0.4.0
type OptionsUuid struct {
Uuid string `json:"uuid"`
}
OptionsUuid uuid
type UuidLoader ¶ added in v0.4.0
UuidLoader uuid loader
Click to show internal directories.
Click to hide internal directories.