storage

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: MIT Imports: 8 Imported by: 0

README

Module Storage

Storage APIs
GET /api/v1/storage/presigned-url
POST /api/v1/storage/uploads
PUT /api/v1/storage/uploads/{file_name}
PUT /api/v1/storage/legitimize-files
Usage

Install

go get -u github.com/gflydev/modules/storage@v1.0.1

File main.go

import (
    _ "github.com/gflydev/cache/redis"
    _ "github.com/gflydev/storage/local"
)

File api_routes.go

import "github.com/gflydev/modules/storage/api"

// `API` Router
g.Group(prefixAPI, func(apiRouter *core.Group) {
    /* ============================ Storage Group ==========================================*/
    apiRouter.Group("/storage", func(uploadGroup *core.Group) {
        uploadGroup.GET("/presigned-url", api.NewPresignedURLApi())      // Get presigned URL
        uploadGroup.POST("/uploads", api.NewUploadApi())                 // Upload files to server by Field Form
        uploadGroup.PUT("/uploads/{file_name}", api.NewUploadFileApi())  // Upload a file to server via Body (Binary)
        uploadGroup.PUT("/legitimize-files", api.NewLegitimizeFileApi()) // Legitimize uploaded file
    })
})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LegitimizeFiles

func LegitimizeFiles(files []dto.LegitimizeItem) []dto.LegitimizeItem

LegitimizeFiles make file list available

func PresignedURL

func PresignedURL(objectKey string) (string, string, error)

PresignedURL generate pre-signed upload URL from Local storage

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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