images

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// 画像変換のPubSubトピックID
	ConverterTopicID string = "image-converter"

	// 画像作成のPubSubトピックID
	GeneratorTopicID string = "image-generator"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cPubSub *cloudpubsub.Client) *Client

func NewClientWithOption

func NewClientWithOption(cPubSub *cloudpubsub.Client, reqOption *ClientOption) *Client

func (*Client) SendConvertRequest

func (c *Client) SendConvertRequest(
	ctx context.Context,
	key string,
	sourceID string,
	sources []*Object,
	dstFilePath string,
) error

画像変換リクエストを送信する

func (*Client) SendGenerateRequest

func (c *Client) SendGenerateRequest(
	ctx context.Context,
	key string,
	sourceID string,
	sourceURL string,
	width int,
	height int,
	dstFilePath string,
) error

画像作成リクエストを送信する

type ClientOption

type ClientOption struct {
	ConverterTopicID string
	GeneratorTopicID string
}

type ConvertRequest

type ConvertRequest struct {
	Key         string   `json:"key"`
	SourceID    string   `json:"source_id"`
	SourceURLs  []string `json:"source_urls"`
	DstFilePath string   `json:"dst_file_path"`
}

画像変換リクエスト

type GenerateRequest

type GenerateRequest struct {
	Key         string `json:"key"`
	SourceID    string `json:"source_id"`
	SourceURL   string `json:"source_url"`
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	DstFilePath string `json:"dst_file_path"`
}

画像作成リクエスト

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(repo Repository) *Handler

func (*Handler) UpdateByConvertObjects

func (h *Handler) UpdateByConvertObjects(w http.ResponseWriter, r *http.Request)

変換後の画像をアップデートする

func (*Handler) UpdateByGenerateURL

func (h *Handler) UpdateByGenerateURL(w http.ResponseWriter, r *http.Request)

作成したOGPをアップデートする

type Object

type Object struct {
	ID            string           `firestore:"id"             json:"id"`
	OriginalURL   string           `firestore:"original_url"   json:"original_url"`
	URL           string           `firestore:"url"            json:"url"`
	Filename      string           `firestore:"filename"       json:"filename"`
	ContentType   string           `firestore:"content_type"   json:"content_type"`
	DominantColor string           `firestore:"dominant_color" json:"dominant_color"`
	Sizes         map[string]*Size `firestore:"sizes"          json:"sizes"`
	IsDefault     bool             `firestore:"is_default"     json:"is_default"`
}

画像オブジェクト

type Repository

type Repository interface {
	UpdateByConvertObjects(ctx context.Context, key string, objects []*Object) error
	UpdateByGenerateURL(ctx context.Context, key string, id string, url string) error
}

リポジトリ

type Size

type Size struct {
	URL    string `firestore:"url"    json:"url"`
	Width  int    `firestore:"width"  json:"width"`
	Height int    `firestore:"height" json:"height"`
}

サイズ

Jump to

Keyboard shortcuts

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