core

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2025 License: MIT Imports: 13 Imported by: 41

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 added in v1.0.0

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_INVALID   CalendarDisplayType = 255
)

Calendar Display Type

func (CalendarDisplayType) String added in v1.0.0

func (f CalendarDisplayType) String() string

String returns a textual representation of the calendar display type enum

type CliContext added in v0.6.0

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

CliContext represents the command-line context

func WrapCilContext added in v0.6.0

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

WrapCliContext returns a context wrapped by this file

func (*CliContext) Bool added in v0.9.0

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

Bool returns the boolean value of parameter

func (*CliContext) GetClientLocale added in v0.6.0

func (c *CliContext) GetClientLocale() string

GetClientLocale returns the client locale name

func (*CliContext) GetContextId added in v0.6.0

func (c *CliContext) GetContextId() string

GetContextId returns the current context id

func (*CliContext) Int added in v0.9.0

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

Int returns the integer value of parameter

func (*CliContext) String added in v0.9.0

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

String returns the string value of parameter

type CliHandlerFunc added in v0.6.0

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 added in v0.9.0

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 added in v0.9.0

func (d CoordinateDisplayType) String() string

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

type CronContext added in v0.6.0

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

CronContext represents the cron job context

func NewCronJobContext added in v0.6.0

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

NewCronJobContext returns a new cron job context

func (*CronContext) GetClientLocale added in v0.6.0

func (c *CronContext) GetClientLocale() string

GetClientLocale returns the client locale name

func (*CronContext) GetContextId added in v0.6.0

func (c *CronContext) GetContextId() string

GetContextId returns the current context id

func (*CronContext) GetInterval added in v0.6.0

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

GetInterval returns the current cron job interval

type CurrencyDisplayType added in v0.6.0

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 added in v0.6.0

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 added in v1.0.0

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_INVALID   DateDisplayType = 255
)

Date Display Type

func (DateDisplayType) String added in v1.0.0

func (f DateDisplayType) String() string

String returns a textual representation of the date display type enum

type DecimalSeparator added in v0.5.0

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 added in v0.5.0

func (f DecimalSeparator) String() string

String returns a textual representation of the decimal separator enum

type DigitGroupingSymbol added in v0.5.0

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 added in v0.5.0

func (f DigitGroupingSymbol) String() string

String returns a textual representation of the digit grouping symbol enum

type DigitGroupingType added in v0.5.0

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 added in v0.5.0

func (d DigitGroupingType) String() string

String returns a textual representation of the digit grouping type enum

type EventStreamApiHandlerFunc added in v0.9.0

type EventStreamApiHandlerFunc func(*WebContext) *errs.Error

EventStreamApiHandlerFunc represents the event stream api handler function

type FiscalYearFormat added in v0.10.0

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 added in v0.10.0

func (f FiscalYearFormat) String() string

String returns a textual representation of the long date format enum

type FiscalYearStart added in v0.10.0

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 added in v0.10.0

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

NewFiscalYearStart creates a new FiscalYearStart from month and day values

func (FiscalYearStart) GetMonthDay added in v0.10.0

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

GetMonthDay extracts the month and day from FiscalYearType

func (FiscalYearStart) String added in v0.10.0

func (f FiscalYearStart) String() string

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

type IPPattern added in v0.10.0

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

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

func ParseIPPattern added in v0.10.0

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

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

func ParseIPv4Pattern added in v0.10.0

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

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

func ParseIPv6Pattern added in v0.10.0

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

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

func (*IPPattern) GobDecode added in v0.10.0

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

GobDecode decodes the data into the IP pattern

func (*IPPattern) GobEncode added in v0.10.0

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

GobEncode returns the encoded data for this IP pattern

func (*IPPattern) Match added in v0.10.0

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

Match returns if the given IP address matches the pattern

type ImageHandlerFunc added in v0.5.0

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

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

type JSONRPCApiHandlerFunc added in v0.10.0

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

JSONRPCApiHandlerFunc represents the api handler function

type JSONRPCError added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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 added in v0.10.0

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

NewJSONRPCErrorResponse creates a new JSON-RPC error response

func NewJSONRPCErrorResponseWithCause added in v0.10.0

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

NewJSONRPCErrorResponseWithCause creates a new JSON-RPC error response

func NewJSONRPCResponse added in v0.10.0

func NewJSONRPCResponse(id any, result any) *JSONRPCResponse

NewJSONRPCResponse creates a new JSON-RPC response with the result

type LongDateFormat added in v0.6.0

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 added in v0.6.0

func (f LongDateFormat) String() string

String returns a textual representation of the long date format enum

type LongTimeFormat added in v0.6.0

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 added in v0.6.0

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 added in v0.6.0

type NullContext struct {
	context.Context
}

NullContext represents the null context

func NewNullContext added in v0.6.0

func NewNullContext() *NullContext

NewCronJobContext returns a new null context

func (*NullContext) GetClientLocale added in v0.6.0

func (c *NullContext) GetClientLocale() string

GetClientLocale returns the client locale name

func (*NullContext) GetContextId added in v0.6.0

func (c *NullContext) GetContextId() string

GetContextId returns the current context id

type NumeralSystem added in v1.0.0

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 added in v1.0.0

func (f NumeralSystem) String() string

String returns a textual representation of the decimal separator enum

type ProxyHandlerFunc added in v0.3.0

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

ProxyHandlerFunc represents the reverse proxy handler function

type ShortDateFormat added in v0.6.0

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 added in v0.6.0

func (f ShortDateFormat) String() string

String returns a textual representation of the short date format enum

type ShortTimeFormat added in v0.6.0

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 added in v0.6.0

func (f ShortTimeFormat) String() string

String returns a textual representation of the short time format enum

type TaskProcessUpdateHandler added in v0.9.0

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 added in v0.6.0

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 added in v0.7.0

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

func (UserFeatureRestrictionType) String added in v0.7.0

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

type UserFeatureRestrictions added in v0.7.0

type UserFeatureRestrictions uint64

UserFeatureRestrictions represents all the restrictions of user features

func ParseUserFeatureRestrictions added in v0.7.0

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 added in v0.7.0

Add returns a new feature restrictions with the specified feature

func (UserFeatureRestrictions) Contains added in v0.7.0

func (r UserFeatureRestrictions) Contains(featureRestrictionType UserFeatureRestrictionType) bool

Contains returns whether contains the specified feature

func (UserFeatureRestrictions) Remove added in v0.7.0

Remove returns a new feature restrictions without the specified feature

func (UserFeatureRestrictions) String added in v0.7.0

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 added in v0.3.0

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

GetAudience returns the audience of this token

func (*UserTokenClaims) GetExpirationTime added in v0.3.0

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

GetExpirationTime returns the expiration time of this token

func (*UserTokenClaims) GetIssuedAt added in v0.3.0

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

GetIssuedAt returns the issue time of this token

func (*UserTokenClaims) GetIssuer added in v0.3.0

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

GetIssuer returns the issuer of this token

func (*UserTokenClaims) GetNotBefore added in v0.3.0

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

GetNotBefore returns the earliest valid time of this token

func (*UserTokenClaims) GetSubject added in v0.3.0

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

GetSubject returns the subject of this token

type WebContext added in v0.6.0

type WebContext struct {
	*gin.Context
}

WebContext represents the request and response context

func WrapWebContext added in v0.6.0

func WrapWebContext(ginCtx *gin.Context) *WebContext

WrapWebContext returns a context wrapped by this file

func (*WebContext) ClientPort added in v0.6.0

func (c *WebContext) ClientPort() uint16

func (*WebContext) GetClientLocale added in v0.6.0

func (c *WebContext) GetClientLocale() string

GetClientLocale returns the client locale name

func (*WebContext) GetClientTimezoneOffset added in v0.6.0

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

GetClientTimezoneOffset returns the client timezone offset

func (*WebContext) GetContextId added in v0.6.0

func (c *WebContext) GetContextId() string

GetContextId returns the current request id

func (*WebContext) GetCurrentUid added in v0.6.0

func (c *WebContext) GetCurrentUid() int64

GetCurrentUid returns the current user uid by the current user token

func (*WebContext) GetResponseError added in v0.6.0

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

GetResponseError returns the response error

func (*WebContext) GetTextualToken added in v0.6.0

func (c *WebContext) GetTextualToken() string

GetTextualToken returns the current user textual token

func (*WebContext) GetTokenClaims added in v0.6.0

func (c *WebContext) GetTokenClaims() *UserTokenClaims

GetTokenClaims returns the current user token

func (*WebContext) GetTokenStringFromCookie added in v1.0.0

func (c *WebContext) GetTokenStringFromCookie() string

GetTokenStringFromCookie returns the token string from the request cookie

func (*WebContext) GetTokenStringFromHeader added in v1.0.0

func (c *WebContext) GetTokenStringFromHeader() string

GetTokenStringFromHeader returns the token string from the request header

func (*WebContext) GetTokenStringFromQueryString added in v1.0.0

func (c *WebContext) GetTokenStringFromQueryString() string

GetTokenStringFromQueryString returns the token string from the request query string

func (*WebContext) SetContextId added in v0.6.0

func (c *WebContext) SetContextId(requestId string)

SetContextId sets the given request id to context

func (*WebContext) SetResponseError added in v0.6.0

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

SetResponseError sets the response error

func (*WebContext) SetTextualToken added in v0.6.0

func (c *WebContext) SetTextualToken(token string)

SetTextualToken sets the given user token to context

func (*WebContext) SetTokenClaims added in v0.6.0

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

SetTokenClaims sets the given user token to context

func (*WebContext) SetTokenStringToCookie added in v1.0.0

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

type WeekDay added in v0.6.0

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 added in v0.6.0

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