Documentation
¶
Overview ¶
SPDX-License-Identifier: AGPL-3.0-or-later Copyright (C) 2024 Japan7
SPDX-License-Identifier: AGPL-3.0-or-later Copyright (C) 2024 Japan7
SPDX-License-Identifier: AGPL-3.0-or-later Copyright (C) 2024 Japan7
SPDX-License-Identifier: AGPL-3.0-or-later Copyright (C) 2024 Japan7
SPDX-License-Identifier: AGPL-3.0-or-later Copyright (C) 2024 Japan7
Index ¶
- Variables
- func CreateTempFile(ctx context.Context, tempfile *UploadTempFile, reader io.Reader) error
- func DeleteObject(ctx context.Context, filename string) error
- func Download(ctx context.Context, input *DownloadInput) (*huma.StreamResponse, error)
- func GetFileObject(ctx context.Context, filename string) (*minio.Object, error)
- func MakeCli()
- func RunProducer(app *fiber.App, api huma.API)
- func SetupProducer() (*fiber.App, huma.API)
- func UploadToS3(ctx context.Context, file io.Reader, file_id string, filename string, ...) error
- type DownloadHeadOutput
- type DownloadInput
- type FileSender
- type ProducerConfig
- type ProducerListenConfig
- type ProducerS3Config
- type ProducerUploadConfig
- type TestedClient
- type UploadData
- type UploadInput
- type UploadInputDefinition
- type UploadOutput
- type UploadTempFile
Constants ¶
This section is empty.
Variables ¶
View Source
var BEARER_PREFIX = "Bearer "
View Source
var CONFIG = getProducerConfig()
View Source
var S3_BEST_CLIENT *minio.Client
Functions ¶
func CreateTempFile ¶
func Download ¶
func Download(ctx context.Context, input *DownloadInput) (*huma.StreamResponse, error)
func GetFileObject ¶
Types ¶
type DownloadHeadOutput ¶
type DownloadHeadOutput struct {
AcceptRange string `header:"Accept-Range"`
ContentLength int64 `header:"Content-Length"`
ContentType string `header:"Content-Type"`
Expires int64 `header:"Expires"`
}
func DownloadHead ¶
func DownloadHead(ctx context.Context, input *DownloadInput) (*DownloadHeadOutput, error)
type DownloadInput ¶
type FileSender ¶
type FileSender struct {
// Reader should be already at the Range.Start location
Fd io.ReadCloser
Range httputils.Range
BytesRead uint64
}
func (*FileSender) Close ¶
func (f *FileSender) Close() error
type ProducerConfig ¶
type ProducerConfig struct {
Listen ProducerListenConfig `env_prefix:"LISTEN"`
Upload ProducerUploadConfig `env_prefix:"UPLOAD"`
S3 ProducerS3Config `env_prefix:"S3"`
}
type ProducerListenConfig ¶
type ProducerListenConfig struct {
Host string `envkey:"HOST" default:"0.0.0.0"`
Port int `envkey:"PORT" default:"8140"`
}
func (ProducerListenConfig) Addr ¶
func (c ProducerListenConfig) Addr() string
type ProducerS3Config ¶
type ProducerUploadConfig ¶
type TestedClient ¶
type UploadData ¶
type UploadInput ¶
type UploadInput struct {
Auth string `header:"Authorization"`
Expires int64 `header:"Expires"`
FileName string `header:"Filename"`
File UploadTempFile
}
type UploadInputDefinition ¶
type UploadInputDefinition struct {
Auth string `header:"Authorization"`
Expires int64 `header:"Expires"`
FileName string `header:"Filename"`
RawBody huma.MultipartFormFiles[UploadData]
}
type UploadOutput ¶
type UploadOutput struct {
Body struct {
ID string `json:"id"`
URL string `json:"url"`
Expires int64 `json:"expires"`
}
}
func Upload ¶
func Upload(ctx context.Context, input *UploadInput) (*UploadOutput, error)
Click to show internal directories.
Click to hide internal directories.