helper

package
v2.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ThaiWeekDay = map[string]interface{}{
		"Sunday":    "อาทิตย์",
		"Monday":    "จันทร์",
		"Tuesday":   "อังคาร",
		"Wednesday": "พุธ",
		"Thursday":  "พฤหัสบดี",
		"Friday":    "ศุกร์",
		"Saturday":  "เสาร์",
	}
	ThaiShortWeekDay = map[string]interface{}{
		"Sunday":    "อา",
		"Monday":    "จ",
		"Tuesday":   "อ",
		"Wednesday": "พ",
		"Thursday":  "พฤ",
		"Friday":    "ศ",
		"Saturday":  "ส",
	}

	ThaiMonth = map[string]interface{}{
		"January":   "มกราคม",
		"February":  "กุมภาพันธ์",
		"March":     "มีนาคม",
		"April":     "เมษายน",
		"May":       "พฤษภาคม",
		"June":      "มิถุนายน",
		"July":      "กรกฎาคม",
		"August":    "สิงหาคม",
		"September": "กันยายน",
		"October":   "ตุลาคม",
		"November":  "พฤศจิกายน",
		"December":  "ธันวาคม",
	}

	ThaiShortMonth = map[string]interface{}{
		"January":   "ม.ค.",
		"February":  "ก.พ.",
		"March":     "มี.ค.",
		"April":     "เม.ย.",
		"May":       "พ.ค.",
		"June":      "มิ.ค.",
		"July":      "ก.ค.",
		"August":    "ส.ค.",
		"September": "ก.ย.",
		"October":   "ต.ค.",
		"November":  "พ.ย.",
		"December":  "ธ.ค.",
	}
)

Functions

func ConvertTimeToThaiFullDateFormat

func ConvertTimeToThaiFullDateFormat(t time.Time) string

func ConvertTimeToThaiFullDateTimeFormat

func ConvertTimeToThaiFullDateTimeFormat(t time.Time) string

func ConvertTimeToThaiFullTimeFormat

func ConvertTimeToThaiFullTimeFormat(t time.Time) string

func ConvertTimeToThaiShortDateFormat

func ConvertTimeToThaiShortDateFormat(t time.Time) string

func ConvertTimeToThaiShortTimeFormat

func ConvertTimeToThaiShortTimeFormat(t time.Time) string

func HttpBlob

func HttpBlob(ctx *fiber.Ctx, blob []byte) error

func HttpBlobWithCode

func HttpBlobWithCode(ctx *fiber.Ctx, blob []byte, code int) error

func HttpCreated

func HttpCreated(ctx *fiber.Ctx, data interface{}) error

HttpCreated - 201

func HttpErrBadRequest

func HttpErrBadRequest(ctx *fiber.Ctx) error

HttpErrBadRequest - 400

func HttpErrConflict

func HttpErrConflict(ctx *fiber.Ctx) error

HttpErrConflict - 409

func HttpErrForbidden

func HttpErrForbidden(ctx *fiber.Ctx) error

HttpErrForbidden - 403

func HttpErrNotFound

func HttpErrNotFound(ctx *fiber.Ctx) error

HttpErrNotFound - 404

func HttpErrServerError

func HttpErrServerError(ctx *fiber.Ctx, err error, msg interface{}) error

HttpErrServerError - 500

func HttpErrUnAuthorize

func HttpErrUnAuthorize(ctx *fiber.Ctx, err error) error

HttpErrUnAuthorize - 401

func HttpInvalidRequest

func HttpInvalidRequest(ctx *fiber.Ctx, code int, err error, msg interface{}) error

func HttpNoContent

func HttpNoContent(ctx *fiber.Ctx) error

HttpNoContent - 204

func HttpOk

func HttpOk(ctx *fiber.Ctx, data interface{}) error

HttpOk - 200

func HttpOkWithTotal

func HttpOkWithTotal(ctx *fiber.Ctx, data interface{}, total int) error

HttpOkWithTotal - 200

func HttpRedirect

func HttpRedirect(ctx *fiber.Ctx, url string) error

func HttpRedirectWithCode

func HttpRedirectWithCode(ctx *fiber.Ctx, url string, code int) error

func HttpResponse

func HttpResponse(ctx *fiber.Ctx, code int, result server.Result) error

func HttpServerError

func HttpServerError(ctx *fiber.Ctx, code int, err error, msg interface{}) error

func HttpServiceUnavailableError

func HttpServiceUnavailableError(ctx *fiber.Ctx, err error, msg interface{}) error

HttpServiceUnavailableError - 503

func HttpTooLargeBody added in v2.0.9

func HttpTooLargeBody(ctx *fiber.Ctx) error

HttpTooLargeBody - 413

func HttpTooMany added in v2.0.9

func HttpTooMany(ctx *fiber.Ctx) error

HttpTooMany - 429

Types

type Date

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

func (*Date) Convert

func (d *Date) Convert(date string) error

func (*Date) NextDay

func (d *Date) NextDay() time.Time

func (*Date) PreviousDay

func (d *Date) PreviousDay() time.Time

func (*Date) Set

func (d *Date) Set(t time.Time)

func (*Date) ToDateTime

func (d *Date) ToDateTime() time.Time

type Today added in v2.0.9

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

func NewToday added in v2.0.9

func NewToday() Today

func NewTodayWithTime added in v2.0.9

func NewTodayWithTime(t time.Time) Today

func (*Today) Convert added in v2.0.9

func (t *Today) Convert(date string) error

func (*Today) NextDay added in v2.0.9

func (t *Today) NextDay() time.Time

func (*Today) PreviousDay added in v2.0.9

func (t *Today) PreviousDay() time.Time

func (*Today) Set added in v2.0.9

func (t *Today) Set(d time.Time)

func (*Today) ToDateTime added in v2.0.9

func (t *Today) ToDateTime() time.Time

Jump to

Keyboard shortcuts

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