common

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Success                             = 0
	AuthFailed                          = 10000000
	InvalidParams                       = 10000001
	InvalidUrl                          = 10000002
	ApiRateLimitExceeded                = 10000003
	InvalidUrlScheme                    = 10000004
	ConvertPdfFailed                    = 20000000
	ConvertPdfWriteBytesFailed          = 20000001
	ConvertPdfUploadFailed              = 20000002
	ConvertHtml2ImageFailed             = 30000000
	ConvertHtml2ImageWriteBytesFailed   = 30000001
	ConvertHtml2ImageUploadFailed       = 30000002
	ConvertPdf2ImageFailed              = 40000000
	ConvertPdf2ImageWriteBytesFailed    = 40000001
	ConvertPdf2ImageUploadFailed        = 40000002
	ConvertPdfWatermarkFailed           = 50000000
	ConvertPdfWatermarkWriteBytesFailed = 50000001
	ConvertPdfWatermarkUploadFailed     = 50000002
)

error code defined

View Source
const Version = "0.3.1"

Version Version

Variables

View Source
var ErrMsg = map[int]string{
	Success:                             "",
	AuthFailed:                          "invalid authorization",
	InvalidParams:                       "invalid params",
	InvalidUrl:                          "invalid url",
	ApiRateLimitExceeded:                "api rate limit exceeded",
	InvalidUrlScheme:                    "only support http/https",
	ConvertPdfFailed:                    "failed convert html to pdf",
	ConvertPdfWriteBytesFailed:          "failed convert html to pdf. write bytes failed",
	ConvertPdfUploadFailed:              "failed convert html to pdf. upload failed",
	ConvertHtml2ImageFailed:             "failed convert html to image",
	ConvertHtml2ImageWriteBytesFailed:   "failed convert html to image. write bytes failed",
	ConvertHtml2ImageUploadFailed:       "failed convert html to image. upload failed",
	ConvertPdf2ImageFailed:              "failed convert pdf to image",
	ConvertPdf2ImageWriteBytesFailed:    "failed convert pdf to image. write bytes failed",
	ConvertPdf2ImageUploadFailed:        "failed convert pdf to image. upload failed",
	ConvertPdfWatermarkFailed:           "failed add watermark on pdf",
	ConvertPdfWatermarkWriteBytesFailed: "failed add watermark on pdf. write bytes failed",
	ConvertPdfWatermarkUploadFailed:     "failed add watermark on pdf. upload failed",
}

error msg map defined

Functions

func NewJsonOutput

func NewJsonOutput(ctx iris.Context, outputDTO OutputDTO) (int, error)

Types

type OutputDTO

type OutputDTO struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

func NewDefaultOutputDTO

func NewDefaultOutputDTO(data interface{}) OutputDTO

type ServerStatus

type ServerStatus struct {
	Version    string `json:"version"`
	Goroutines int    `json:"goroutines"`
	Workers    int    `json:"workers"`
	Queue      int64  `json:"queue"`
}

server status

Jump to

Keyboard shortcuts

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