helper

package
v2.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 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

*

  • Blob

func HttpBlobWithCode

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

func HttpCreated

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

201

func HttpErrBadRequest

func HttpErrBadRequest(ctx *fiber.Ctx) error

400

func HttpErrConflict

func HttpErrConflict(ctx *fiber.Ctx) error

409

func HttpErrForbidden

func HttpErrForbidden(ctx *fiber.Ctx) error

403

func HttpErrNotFound

func HttpErrNotFound(ctx *fiber.Ctx) error

404

func HttpErrServerError

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

500

func HttpErrUnAuthorize

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

401

func HttpInvalidRequest

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

*

  • Client request

func HttpNoContent

func HttpNoContent(ctx *fiber.Ctx) error

204

func HttpOk

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

200

func HttpOkWithTotal

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

200

func HttpRedirect

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

*

  • Redirect

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

*

  • General response

func HttpServerError

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

*

  • Server error

func HttpServiceUnavailableError

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

503

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

Jump to

Keyboard shortcuts

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