images

package
v0.0.0-...-2bc625b Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryMetadata = "x-authgear-metadata"
)

Variables

View Source
var DependencySet = wire.NewSet(
	wire.Struct(new(Store), "*"),
)
View Source
var FileMetaSchema = validation.NewSimpleSchema(`
	{
		"type": "object",
		"additionalProperties": false,
		"properties": {
			"user_id": { "type": "string" },
			"uploaded_by": {
				"type": "string",
				"enum": ["user", "admin_api"]
			}
		},
		"required": ["uploaded_by"],
		"allOf": [
			{
				"if": { "properties": { "uploaded_by": { "const": "user" } } },
				"then": {
					"required": ["user_id"]
				}
			}
		]
	}
`)

Functions

func EncodeFileMetaData

func EncodeFileMetaData(metadata *FileMetadata) (string, error)

Types

type File

type File struct {
	ID        string
	Size      int64
	CreatedAt time.Time
	Metadata  *FileMetadata
}

type FileMetadata

type FileMetadata struct {
	UserID     string         `json:"user_id,omitempty"`
	UploadedBy UploadedByType `json:"uploaded_by,omitempty"`
}

func DecodeFileMetadata

func DecodeFileMetadata(encoded string) (*FileMetadata, error)

type Store

type Store struct {
	SQLBuilder  *appdb.SQLBuilderApp
	SQLExecutor *appdb.SQLExecutor
}

func (*Store) Create

func (s *Store) Create(ctx context.Context, i *File) error

type UploadedByType

type UploadedByType string
const (
	UploadedByTypeUser     UploadedByType = "user"
	UploadedByTypeAdminAPI UploadedByType = "admin_api"
)

Jump to

Keyboard shortcuts

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