core

package
v0.0.0-...-a2b69cf Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const AcceptLanguageHeaderName = "Accept-Language"

AcceptLanguageHeaderName represents the header name of accept language

View Source
const ClientTimezoneOffsetHeaderName = "X-Timezone-Offset"

ClientTimezoneOffsetHeaderName represents the header name of client timezone offset

View Source
const JSONRPCVersion = "2.0"

JSONRPCVersion defines the version of JSON-RPC protocol

View Source
const RemoteClientPortHeader = "X-Real-Port"

RemoteClientPortHeader represents the header name of remote client source port

Variables

View Source
var JSONRPCInternalError = &JSONRPCError{
	Code:    -32603,
	Message: "Internal error",
	Data:    nil,
}

JSONRPCInternalError represents the "Internal error" in JSON-RPC 2.0

View Source
var JSONRPCInvalidParamsError = &JSONRPCError{
	Code:    -32602,
	Message: "Invalid params",
	Data:    nil,
}

JSONRPCInvalidParamsError represents the "Invalid params" error in JSON-RPC 2.0

View Source
var JSONRPCMethodNotFoundError = &JSONRPCError{
	Code:    -32601,
	Message: "Method not found",
	Data:    nil,
}

JSONRPCMethodNotFoundError represents the "Method not found" error in JSON-RPC 2.0

View Source
var JSONRPCParseError = &JSONRPCError{
	Code:    -32700,
	Message: "Parse error",
	Data:    nil,
}

JSONRPCParseError represents the "Parse error" in JSON-RPC 2.0

View Source
var MONTH_MAX_DAYS = []uint8{
	uint8(31),
	uint8(28),
	uint8(31),
	uint8(30),
	uint8(31),
	uint8(30),
	uint8(31),
	uint8(31),
	uint8(30),
	uint8(31),
	uint8(30),
	uint8(31),
}

Functions

This section is empty.

Types

type ApiHandlerFunc

type ApiHandlerFunc func(*WebContext) (any, *errs.Error)

ApiHandlerFunc represents the api handler function

type CalendarDisplayType

type CalendarDisplayType byte

CalendarDisplayType represents calendar display type

const (
	CALENDAR_DISPLAY_TYPE_DEFAULT                CalendarDisplayType = 0
	CALENDAR_DISPLAY_TYPE_GREGORAIN              CalendarDisplayType = 1
	CALENDAR_DISPLAY_TYPE_BUDDHIST               CalendarDisplayType = 2
	CALENDAR_DISPLAY_TYPE_GREGORAIN_WITH_CHINESE CalendarDisplayType = 3
	CALENDAR_DISPLAY_TYPE_GREGORAIN_WITH_PERSIAN CalendarDisplayType = 4
	CALENDAR_DISPLAY_TYPE_INVALID                CalendarDisplayType = 255
)

Calendar Display Type

func (CalendarDisplayType) String

func (f CalendarDisplayType) String() string

String returns a textual representation of the calendar display type enum

type CliContext

type CliContext struct {
	context.Context
	// contains filtered or unexported fields
}

CliContext represents the command-line context

func WrapCilContext

func WrapCilContext(ctx context.Context, cmd *cli.Command) *CliContext

WrapCliContext returns a context wrapped by this file

func (*CliContext) Bool

func (c *CliContext) Bool(name string) bool

Bool returns the boolean value of parameter

func (*CliContext) GetClientLocale

func (c *CliContext) GetClientLocale() string

GetClientLocale returns the client locale name

func (*CliContext) GetContextId

func (c *CliContext) GetContextId() string

GetContextId returns the current context id

func (*CliContext) Int

func (c *CliContext) Int(name string) int

Int returns the integer value of parameter

func (*CliContext) String

func (c *CliContext) String(name string) string

String returns the string value of parameter

type CliHandlerFunc

type CliHandlerFunc func(*CliContext) error

CliHandlerFunc represents the cli handler function

type Context

type Context interface {
	context.Context
	GetContextId() string
	GetClientLocale() string
}

Context is the base context of ezBookkeeping

type CoordinateDisplayType

type CoordinateDisplayType byte

CoordinateDisplayType represents the display type of geographic coordinates

const (
	COORDINATE_DISPLAY_TYPE_DEFAULT                                    CoordinateDisplayType = 0
	COORDINATE_DISPLAY_TYPE_LATITUDE_LONGITUDE_DECIMAL_DEGREES         CoordinateDisplayType = 1
	COORDINATE_DISPLAY_TYPE_LONGITUDE_LATITUDE_DECIMAL_DEGREES         CoordinateDisplayType = 2
	COORDINATE_DISPLAY_TYPE_LATITUDE_LONGITUDE_DECIMAL_MINUTES         CoordinateDisplayType = 3
	COORDINATE_DISPLAY_TYPE_LONGITUDE_LATITUDE_DECIMAL_MINUTES         CoordinateDisplayType = 4
	COORDINATE_DISPLAY_TYPE_LATITUDE_LONGITUDE_DEGREES_MINUTES_SECONDS CoordinateDisplayType = 5
	COORDINATE_DISPLAY_TYPE_LONGITUDE_LATITUDE_DEGREES_MINUTES_SECONDS CoordinateDisplayType = 6
	COORDINATE_DISPLAY_TYPE_INVALID                                    CoordinateDisplayType = 255
)

Coordinate Display Type

func (CoordinateDisplayType) String

func (d CoordinateDisplayType) String() string

String returns a textual representation of the geographic coordinates display type enum

type CronContext

type CronContext struct {
	context.Context
	// contains filtered or unexported fields
}

CronContext represents the cron job context

func NewCronJobContext

func NewCronJobContext(cronJobName string, cronJobInterval time.Duration) *CronContext

NewCronJobContext returns a new cron job context

func (*CronContext) GetClientLocale

func (c *CronContext) GetClientLocale() string

GetClientLocale returns the client locale name

func (*CronContext) GetContextId

func (c *CronContext) GetContextId() string

GetContextId returns the current context id

func (*CronContext) GetInterval

func (c *CronContext) GetInterval() time.Duration

GetInterval returns the current cron job interval

type CurrencyDisplayType

type CurrencyDisplayType byte

CurrencyDisplayType represents the display type of amount with currency

const (
	CURRENCY_DISPLAY_TYPE_DEFAULT                            CurrencyDisplayType = 0
	CURRENCY_DISPLAY_TYPE_NONE                               CurrencyDisplayType = 1
	CURRENCY_DISPLAY_TYPE_SYMBOL_BEFORE_AMOUNT               CurrencyDisplayType = 2
	CURRENCY_DISPLAY_TYPE_SYMBOL_AFTER_AMOUNT                CurrencyDisplayType = 3
	CURRENCY_DISPLAY_TYPE_SYMBOL_BEFORE_AMOUNT_WITHOUT_SPACE CurrencyDisplayType = 4
	CURRENCY_DISPLAY_TYPE_SYMBOL_AFTER_AMOUNT_WITHOUT_SPACE  CurrencyDisplayType = 5
	CURRENCY_DISPLAY_TYPE_CODE_BEFORE_AMOUNT                 CurrencyDisplayType = 6
	CURRENCY_DISPLAY_TYPE_CODE_AFTER_AMOUNT                  CurrencyDisplayType = 7
	CURRENCY_DISPLAY_TYPE_UNIT_BEFORE_AMOUNT                 CurrencyDisplayType = 8
	CURRENCY_DISPLAY_TYPE_UNIT_AFTER_AMOUNT                  CurrencyDisplayType = 9
	CURRENCY_DISPLAY_TYPE_NAME_BEFORE_AMOUNT                 CurrencyDisplayType = 10
	CURRENCY_DISPLAY_TYPE_NAME_AFTER_AMOUNT                  CurrencyDisplayType = 11
	CURRENCY_DISPLAY_TYPE_INVALID                            CurrencyDisplayType = 255
)

Currency Display Type

func (CurrencyDisplayType) String

func (d CurrencyDisplayType) String() string

String returns a textual representation of the currency display type enum

type DataHandlerFunc

type DataHandlerFunc func(*WebContext) ([]byte, string, *errs.Error)

DataHandlerFunc represents the handler function that returns file data byte array and file name

type DateDisplayType

type DateDisplayType byte

DateDisplayType represents date display type

const (
	DATE_DISPLAY_TYPE_DEFAULT   DateDisplayType = 0
	DATE_DISPLAY_TYPE_GREGORAIN DateDisplayType = 1
	DATE_DISPLAY_TYPE_BUDDHIST  DateDisplayType = 2
	DATE_DISPLAY_TYPE_PERSIAN   DateDisplayType = 3
	DATE_DISPLAY_TYPE_INVALID   DateDisplayType = 255
)

Date Display Type

func (DateDisplayType) String

func (f DateDisplayType) String() string

String returns a textual representation of the date display type enum

type DecimalSeparator

type DecimalSeparator byte

DecimalSeparator represents the type of decimal separator

const (
	DECIMAL_SEPARATOR_DEFAULT DecimalSeparator = 0
	DECIMAL_SEPARATOR_DOT     DecimalSeparator = 1
	DECIMAL_SEPARATOR_COMMA   DecimalSeparator = 2
	DECIMAL_SEPARATOR_INVALID DecimalSeparator = 255
)

Decimal Separator

func (DecimalSeparator) String

func (f DecimalSeparator) String() string

String returns a textual representation of the decimal separator enum

type DigitGroupingSymbol

type DigitGroupingSymbol byte

DigitGroupingSymbol represents the digit grouping symbol

const (
	DIGIT_GROUPING_SYMBOL_DEFAULT    DigitGroupingSymbol = 0
	DIGIT_GROUPING_SYMBOL_DOT        DigitGroupingSymbol = 1
	DIGIT_GROUPING_SYMBOL_COMMA      DigitGroupingSymbol = 2
	DIGIT_GROUPING_SYMBOL_SPACE      DigitGroupingSymbol = 3
	DIGIT_GROUPING_SYMBOL_APOSTROPHE DigitGroupingSymbol = 4
	DIGIT_GROUPING_SYMBOL_INVALID    DigitGroupingSymbol = 255
)

Digit Grouping Symbol

func (DigitGroupingSymbol) String

func (f DigitGroupingSymbol) String() string

String returns a textual representation of the digit grouping symbol enum

type DigitGroupingType

type DigitGroupingType byte

DigitGroupingType represents digit grouping type

const (
	DIGIT_GROUPING_TYPE_DEFAULT                DigitGroupingType = 0
	DIGIT_GROUPING_TYPE_NONE                   DigitGroupingType = 1
	DIGIT_GROUPING_TYPE_THOUSANDS_SEPARATOR    DigitGroupingType = 2
	DIGIT_GROUPING_TYPE_INDIAN_NUMBER_GROUPING DigitGroupingType = 3
	DIGIT_GROUPING_TYPE_INVALID                DigitGroupingType = 255
)

Digit Grouping Type

func (DigitGroupingType) String

func (d DigitGroupingType) String() string

String returns a textual representation of the digit grouping type enum

type EventStreamApiHandlerFunc

type EventStreamApiHandlerFunc func(*WebContext) *errs.Error

EventStreamApiHandlerFunc represents the event stream api handler function

type FiscalYearFormat

type FiscalYearFormat uint8

FiscalYearFormat represents the fiscal year format as a uint8

const (
	FISCAL_YEAR_FORMAT_DEFAULT           FiscalYearFormat = 0
	FISCAL_YEAR_FORMAT_STARTYYYY_ENDYYYY FiscalYearFormat = 1
	FISCAL_YEAR_FORMAT_STARTYYYY_ENDYY   FiscalYearFormat = 2
	FISCAL_YEAR_FORMAT_STARTYY_ENDYY     FiscalYearFormat = 3
	FISCAL_YEAR_FORMAT_ENDYYYY           FiscalYearFormat = 4
	FISCAL_YEAR_FORMAT_ENDYY             FiscalYearFormat = 5
	FISCAL_YEAR_FORMAT_INVALID           FiscalYearFormat = 255 // Invalid
)

Fiscal Year Format Type Name

func (FiscalYearFormat) String

func (f FiscalYearFormat) String() string

String returns a textual representation of the long date format enum

type FiscalYearStart

type FiscalYearStart uint16

FiscalYearStart represents the fiscal year start date as a uint16 (month: high byte, day: low byte)

const (
	FISCAL_YEAR_START_DEFAULT FiscalYearStart = 0x0101 // January 1
	FISCAL_YEAR_START_MIN     FiscalYearStart = 0x0101 // January 1
	FISCAL_YEAR_START_MAX     FiscalYearStart = 0x0C1F // December 31
	FISCAL_YEAR_START_INVALID FiscalYearStart = 0xFFFF // Invalid
)

Fiscal Year Start Date Type

func NewFiscalYearStart

func NewFiscalYearStart(month uint8, day uint8) (FiscalYearStart, error)

NewFiscalYearStart creates a new FiscalYearStart from month and day values

func (FiscalYearStart) GetMonthDay

func (f FiscalYearStart) GetMonthDay() (uint8, uint8, error)

GetMonthDay extracts the month and day from FiscalYearType

func (FiscalYearStart) String

func (f FiscalYearStart) String() string

String returns a string representation of FiscalYearStart in MM/DD format

type IPPattern

type IPPattern struct {
	Pattern string
	// contains filtered or unexported fields
}

IPPattern represents a pattern for matching IP addresses, either IPv4 or IPv6

func ParseIPPattern

func ParseIPPattern(ipPattern string) (*IPPattern, error)

ParseIPPattern parses the given IP address pattern and returns an IPPattern object

func ParseIPv4Pattern

func ParseIPv4Pattern(ipPattern string) (*IPPattern, error)

ParseIPv4Pattern parses the given IPv4 address pattern and returns an IPPattern object

func ParseIPv6Pattern

func ParseIPv6Pattern(ipPattern string) (*IPPattern, error)

ParseIPv6Pattern parses the given IPv6 address pattern and returns an IPPattern object

func (*IPPattern) GobDecode

func (p *IPPattern) GobDecode(data []byte) error

GobDecode decodes the data into the IP pattern

func (*IPPattern) GobEncode

func (p *IPPattern) GobEncode() ([]byte, error)

GobEncode returns the encoded data for this IP pattern

func (*IPPattern) Match

func (p *IPPattern) Match(ip string) bool

Match returns if the given IP address matches the pattern

type ImageHandlerFunc

type ImageHandlerFunc func(*WebContext) ([]byte, string, *errs.Error)

ImageHandlerFunc represents the handler function that returns image byte array and content type

type JSONRPCApiHandlerFunc

type JSONRPCApiHandlerFunc func(*WebContext, *JSONRPCRequest) (any, *errs.Error)

JSONRPCApiHandlerFunc represents the api handler function

type JSONRPCError

type JSONRPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data,omitempty"`
}

JSONRPCError represents the JSON-RPC 2.0 error object

type JSONRPCRequest

type JSONRPCRequest struct {
	JSONRPC string          `json:"jsonrpc"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
	ID      any             `json:"id,omitempty"`
}

JSONRPCRequest represents the JSON-RPC 2.0 request

type JSONRPCResponse

type JSONRPCResponse struct {
	JSONRPC string        `json:"jsonrpc"`
	Result  any           `json:"result,omitempty"`
	Error   *JSONRPCError `json:"error,omitempty"`
	ID      any           `json:"id,omitempty"`
}

JSONRPCResponse represents the JSON-RPC 2.0 response

func NewJSONRPCErrorResponse

func NewJSONRPCErrorResponse(id any, err *JSONRPCError) *JSONRPCResponse

NewJSONRPCErrorResponse creates a new JSON-RPC error response

func NewJSONRPCErrorResponseWithCause

func NewJSONRPCErrorResponseWithCause(id any, err *JSONRPCError, cause string) *JSONRPCResponse

NewJSONRPCErrorResponseWithCause creates a new JSON-RPC error response

func NewJSONRPCResponse

func NewJSONRPCResponse(id any, result any) *JSONRPCResponse

NewJSONRPCResponse creates a new JSON-RPC response with the result

type LongDateFormat

type LongDateFormat byte

LongDateFormat represents long date format

const (
	LONG_DATE_FORMAT_DEFAULT  LongDateFormat = 0
	LONG_DATE_FORMAT_YYYY_M_D LongDateFormat = 1
	LONG_DATE_FORMAT_M_D_YYYY LongDateFormat = 2
	LONG_DATE_FORMAT_D_M_YYYY LongDateFormat = 3
	LONG_DATE_FORMAT_INVALID  LongDateFormat = 255
)

Long Date Format

func (LongDateFormat) String

func (f LongDateFormat) String() string

String returns a textual representation of the long date format enum

type LongTimeFormat

type LongTimeFormat byte

LongTimeFormat represents long time format

const (
	LONG_TIME_FORMAT_DEFAULT    LongTimeFormat = 0
	LONG_TIME_FORMAT_HH_MM_SS   LongTimeFormat = 1
	LONG_TIME_FORMAT_A_HH_MM_SS LongTimeFormat = 2
	LONG_TIME_FORMAT_HH_MM_SS_A LongTimeFormat = 3
	LONG_TIME_FORMAT_INVALID    LongTimeFormat = 255
)

Long Time Format

func (LongTimeFormat) String

func (f LongTimeFormat) String() string

String returns a textual representation of the long time format enum

type MiddlewareHandlerFunc

type MiddlewareHandlerFunc func(*WebContext)

MiddlewareHandlerFunc represents the middleware handler function

type NullContext

type NullContext struct {
	context.Context
}

NullContext represents the null context

func NewNullContext

func NewNullContext() *NullContext

NewCronJobContext returns a new null context

func (*NullContext) GetClientLocale

func (c *NullContext) GetClientLocale() string

GetClientLocale returns the client locale name

func (*NullContext) GetContextId

func (c *NullContext) GetContextId() string

GetContextId returns the current context id

type NumeralSystem

type NumeralSystem byte

NumeralSystem represents the type of numeral system

const (
	NUMERAL_SYSTEM_DEFAULT                 NumeralSystem = 0
	NUMERAL_SYSTEM_WESTERN_ARABIC_NUMERALS NumeralSystem = 1
	NUMERAL_SYSTEM_EASTERN_ARABIC_NUMERALS NumeralSystem = 2
	NUMERAL_SYSTEM_PERSIAN_DIGITS          NumeralSystem = 3
	NUMERAL_SYSTEM_BURMESE_NUMERALS        NumeralSystem = 4
	NUMERAL_SYSTEM_DEVANAGARI_NUMERALS     NumeralSystem = 5
	NUMERAL_SYSTEM_INVALID                 NumeralSystem = 255
)

Numeral System

func (NumeralSystem) String

func (f NumeralSystem) String() string

String returns a textual representation of the decimal separator enum

type O

type O map[string]any

O is a shortcut for map[string]any

type ProxyHandlerFunc

type ProxyHandlerFunc func(*WebContext) (*httputil.ReverseProxy, *errs.Error)

ProxyHandlerFunc represents the reverse proxy handler function

type ShortDateFormat

type ShortDateFormat byte

ShortDateFormat represents short date format

const (
	SHORT_DATE_FORMAT_DEFAULT  ShortDateFormat = 0
	SHORT_DATE_FORMAT_YYYY_M_D ShortDateFormat = 1
	SHORT_DATE_FORMAT_M_D_YYYY ShortDateFormat = 2
	SHORT_DATE_FORMAT_D_M_YYYY ShortDateFormat = 3
	SHORT_DATE_FORMAT_INVALID  ShortDateFormat = 255
)

Short Date Format

func (ShortDateFormat) String

func (f ShortDateFormat) String() string

String returns a textual representation of the short date format enum

type ShortTimeFormat

type ShortTimeFormat byte

ShortTimeFormat represents short time format

const (
	SHORT_TIME_FORMAT_DEFAULT ShortTimeFormat = 0
	SHORT_TIME_FORMAT_HH_MM   ShortTimeFormat = 1
	SHORT_TIME_FORMAT_A_HH_MM ShortTimeFormat = 2
	SHORT_TIME_FORMAT_HH_MM_A ShortTimeFormat = 3
	SHORT_TIME_FORMAT_INVALID ShortTimeFormat = 255
)

Short Time Format

func (ShortTimeFormat) String

func (f ShortTimeFormat) String() string

String returns a textual representation of the short time format enum

type TaskProcessUpdateHandler

type TaskProcessUpdateHandler func(currentProcess float64)

TaskProcessUpdateHandler represents the task process update handler

type TokenType

type TokenType byte

TokenType represents token type

const (
	USER_TOKEN_TYPE_NORMAL         TokenType = 1
	USER_TOKEN_TYPE_REQUIRE_2FA    TokenType = 2
	USER_TOKEN_TYPE_EMAIL_VERIFY   TokenType = 3
	USER_TOKEN_TYPE_PASSWORD_RESET TokenType = 4
	USER_TOKEN_TYPE_MCP            TokenType = 5
)

Token types

type UserAvatarProviderType

type UserAvatarProviderType string

UserAvatarProviderType represents type of the user avatar provider

const (
	USER_AVATAR_PROVIDER_INTERNAL UserAvatarProviderType = "internal"
	USER_AVATAR_PROVIDER_GRAVATAR UserAvatarProviderType = "gravatar"
)

User avatar provider types

type UserFeatureRestrictionType

type UserFeatureRestrictionType uint64

UserFeatureRestrictionType represents the restriction type of user features

const (
	USER_FEATURE_RESTRICTION_TYPE_UPDATE_PASSWORD                              UserFeatureRestrictionType = 1
	USER_FEATURE_RESTRICTION_TYPE_UPDATE_EMAIL                                 UserFeatureRestrictionType = 2
	USER_FEATURE_RESTRICTION_TYPE_UPDATE_PROFILE_BASIC_INFO                    UserFeatureRestrictionType = 3
	USER_FEATURE_RESTRICTION_TYPE_UPDATE_AVATAR                                UserFeatureRestrictionType = 4
	USER_FEATURE_RESTRICTION_TYPE_REVOKE_OTHER_SESSION                         UserFeatureRestrictionType = 5
	USER_FEATURE_RESTRICTION_TYPE_ENABLE_2FA                                   UserFeatureRestrictionType = 6
	USER_FEATURE_RESTRICTION_TYPE_DISABLE_2FA                                  UserFeatureRestrictionType = 7
	USER_FEATURE_RESTRICTION_TYPE_FORGET_PASSWORD                              UserFeatureRestrictionType = 8
	USER_FEATURE_RESTRICTION_TYPE_IMPORT_TRANSACTION                           UserFeatureRestrictionType = 9
	USER_FEATURE_RESTRICTION_TYPE_EXPORT_TRANSACTION                           UserFeatureRestrictionType = 10
	USER_FEATURE_RESTRICTION_TYPE_CLEAR_ALL_DATA                               UserFeatureRestrictionType = 11
	USER_FEATURE_RESTRICTION_TYPE_SYNC_APPLICATION_SETTINGS                    UserFeatureRestrictionType = 12
	USER_FEATURE_RESTRICTION_TYPE_MCP_ACCESS                                   UserFeatureRestrictionType = 13
	USER_FEATURE_RESTRICTION_TYPE_CREATE_TRANSACTION_FROM_AI_IMAGE_RECOGNITION UserFeatureRestrictionType = 14
)

User Feature Restriction Type

func (UserFeatureRestrictionType) String

String returns a textual representation of the restriction type of user features

type UserFeatureRestrictions

type UserFeatureRestrictions uint64

UserFeatureRestrictions represents all the restrictions of user features

func ParseUserFeatureRestrictions

func ParseUserFeatureRestrictions(featureRestrictions string) UserFeatureRestrictions

ParseUserFeatureRestrictions returns restrictions of user features according to the textual restrictions of user features separated by commas

func (UserFeatureRestrictions) Add

Add returns a new feature restrictions with the specified feature

func (UserFeatureRestrictions) Contains

func (r UserFeatureRestrictions) Contains(featureRestrictionType UserFeatureRestrictionType) bool

Contains returns whether contains the specified feature

func (UserFeatureRestrictions) Remove

Remove returns a new feature restrictions without the specified feature

func (UserFeatureRestrictions) String

func (r UserFeatureRestrictions) String() string

String returns a textual representation of all the restrictions of user features

type UserTokenClaims

type UserTokenClaims struct {
	UserTokenId string    `json:"userTokenId"`
	Uid         int64     `json:"jti,string"`
	Username    string    `json:"username,omitempty"`
	Type        TokenType `json:"type"`
	IssuedAt    int64     `json:"iat"`
	ExpiresAt   int64     `json:"exp"`
}

UserTokenClaims represents user token

func (*UserTokenClaims) GetAudience

func (c *UserTokenClaims) GetAudience() (jwt.ClaimStrings, error)

GetAudience returns the audience of this token

func (*UserTokenClaims) GetExpirationTime

func (c *UserTokenClaims) GetExpirationTime() (*jwt.NumericDate, error)

GetExpirationTime returns the expiration time of this token

func (*UserTokenClaims) GetIssuedAt

func (c *UserTokenClaims) GetIssuedAt() (*jwt.NumericDate, error)

GetIssuedAt returns the issue time of this token

func (*UserTokenClaims) GetIssuer

func (c *UserTokenClaims) GetIssuer() (string, error)

GetIssuer returns the issuer of this token

func (*UserTokenClaims) GetNotBefore

func (c *UserTokenClaims) GetNotBefore() (*jwt.NumericDate, error)

GetNotBefore returns the earliest valid time of this token

func (*UserTokenClaims) GetSubject

func (c *UserTokenClaims) GetSubject() (string, error)

GetSubject returns the subject of this token

type WebContext

type WebContext struct {
	*gin.Context
}

WebContext represents the request and response context

func WrapWebContext

func WrapWebContext(ginCtx *gin.Context) *WebContext

WrapWebContext returns a context wrapped by this file

func (*WebContext) ClientPort

func (c *WebContext) ClientPort() uint16

func (*WebContext) GetClientLocale

func (c *WebContext) GetClientLocale() string

GetClientLocale returns the client locale name

func (*WebContext) GetClientTimezoneOffset

func (c *WebContext) GetClientTimezoneOffset() (int16, error)

GetClientTimezoneOffset returns the client timezone offset

func (*WebContext) GetContextId

func (c *WebContext) GetContextId() string

GetContextId returns the current request id

func (*WebContext) GetCurrentUid

func (c *WebContext) GetCurrentUid() int64

GetCurrentUid returns the current user uid by the current user token

func (*WebContext) GetResponseError

func (c *WebContext) GetResponseError() *errs.Error

GetResponseError returns the response error

func (*WebContext) GetTextualToken

func (c *WebContext) GetTextualToken() string

GetTextualToken returns the current user textual token

func (*WebContext) GetTokenClaims

func (c *WebContext) GetTokenClaims() *UserTokenClaims

GetTokenClaims returns the current user token

func (*WebContext) GetTokenStringFromCookie

func (c *WebContext) GetTokenStringFromCookie() string

GetTokenStringFromCookie returns the token string from the request cookie

func (*WebContext) GetTokenStringFromHeader

func (c *WebContext) GetTokenStringFromHeader() string

GetTokenStringFromHeader returns the token string from the request header

func (*WebContext) GetTokenStringFromQueryString

func (c *WebContext) GetTokenStringFromQueryString() string

GetTokenStringFromQueryString returns the token string from the request query string

func (*WebContext) SetContextId

func (c *WebContext) SetContextId(requestId string)

SetContextId sets the given request id to context

func (*WebContext) SetResponseError

func (c *WebContext) SetResponseError(error *errs.Error)

SetResponseError sets the response error

func (*WebContext) SetTextualToken

func (c *WebContext) SetTextualToken(token string)

SetTextualToken sets the given user token to context

func (*WebContext) SetTokenClaims

func (c *WebContext) SetTokenClaims(claims *UserTokenClaims)

SetTokenClaims sets the given user token to context

func (*WebContext) SetTokenStringToCookie

func (c *WebContext) SetTokenStringToCookie(token string, tokenExpiredTime int, path string)

type WeekDay

type WeekDay byte

WeekDay represents week day

const (
	WEEKDAY_SUNDAY    WeekDay = 0
	WEEKDAY_MONDAY    WeekDay = 1
	WEEKDAY_TUESDAY   WeekDay = 2
	WEEKDAY_WEDNESDAY WeekDay = 3
	WEEKDAY_THURSDAY  WeekDay = 4
	WEEKDAY_FRIDAY    WeekDay = 5
	WEEKDAY_SATURDAY  WeekDay = 6
	WEEKDAY_INVALID   WeekDay = 255
)

Week days

func (WeekDay) String

func (d WeekDay) String() string

String returns a textual representation of the week day enum

Jump to

Keyboard shortcuts

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