upload

package module
v0.0.0-...-0795dde Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: MIT Imports: 5 Imported by: 1

README

bulrush-upload

Provide file upload function

Example

func initUpload() *upload.Upload {
	return upload.New()
}
// Upload Plugin init
var Upload = initUpload()
app.Use(Upload)

API

type Upload struct {
	bulrush.PNBase
	Path            string
	PublicURLPrefix string
	URLPrefix       string
	Save            func(c *gin.Context, files []map[string]interface{})
}

MIT License

Copyright (c) 2018-2020 Double

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandString

func RandString(n int) string

RandString defined gen random string

Types

type FileInfo

type FileInfo struct {
	UUID   string
	Status string
	Name   string
	Size   int64
	URL    string
}

FileInfo defined file info

type Option

type Option func(*Upload) interface{}

Option defined implement of option

func SaveOption

func SaveOption(save func(c *gin.Context, files []FileInfo)) Option

SaveOption defined save

type Upload

type Upload struct {
	Prefix       string
	AssetsPrefix string
	UploadPrefix string
	Save         func(c *gin.Context, files []FileInfo)
}

Upload file plugin

func New

func New() *Upload

New defined return a Upload with default property

func (*Upload) AddOptions

func (upload *Upload) AddOptions(opts ...Option) *Upload

AddOptions defined add option

func (*Upload) Init

func (upload *Upload) Init(init func(*Upload)) *Upload

Init defined Upload init

func (*Upload) Plugin

func (upload *Upload) Plugin(router *gin.RouterGroup)

Plugin for bulrush

Jump to

Keyboard shortcuts

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