Documentation
¶
Index ¶
- func AddOneMonthFallbackToLastDayOfMonth(date time.Time) time.Time
- func CloseToNow(t time.Time) bool
- func ConvertTimeToTimestampPtr(input *time.Time) *timestamppb.Timestamp
- func ConvertToUTC(datetimeStr string) (time.Time, error)
- func EndOfDayInUTC(t time.Time) time.Time
- func FirstTimeOfMonth(year, month int) time.Time
- func GenerateMessageID(domain, metadata string) string
- func GenerateNanoIDWithPrefix(prefix string, length int) string
- func GetAppSourceFromContext(ctx context.Context) string
- func GetAuthUserIdFromContext(ctx context.Context) string
- func GetCurrentTimeInTimeZone(timezone string) time.Time
- func GetRolesFromContext(ctx context.Context) []string
- func GetTenantFromContext(ctx context.Context) string
- func GetUserEmailFromContext(ctx context.Context) string
- func GetUserIdFromContext(ctx context.Context) string
- func IsAfter(t1, t2 *time.Time) bool
- func IsEndOfMonth(t time.Time) bool
- func IsEqualTimePtr(t1, t2 *time.Time) bool
- func IsImpersonatedUserInContext(ctx context.Context) bool
- func LastDayOfMonth(year, month int) time.Time
- func LastTimeOfMonth(year, month int) time.Time
- func MiddleTimeOfMonth(year, month int) time.Time
- func Now() time.Time
- func NowIfZero(t time.Time) time.Time
- func NowPtr() *time.Time
- func SetAppSourceInContext(ctx context.Context, appSource string) context.Context
- func SetTenantInContext(ctx context.Context, tenant string) context.Context
- func SetUserIdInContext(ctx context.Context, userId string) context.Context
- func StartOfDayInUTC(t time.Time) time.Time
- func TimeOrNowFromPtr(t *time.Time) time.Time
- func TimePtr(t time.Time) *time.Time
- func TimestampProtoToTime(pbTime *timestamppb.Timestamp) time.Time
- func TimestampProtoToTimePtr(pbTime *timestamppb.Timestamp) *time.Time
- func ToDate(t time.Time) time.Time
- func ToDateAsAny(t *time.Time) interface{}
- func ToDatePtr(t *time.Time) *time.Time
- func Today() time.Time
- func UnmarshalDateTime(input string) (*time.Time, error)
- func ValidateTenant(ctx context.Context) error
- func WithContext(customContext *CustomContext, next http.Handler) http.Handler
- func WithCustomContext(ctx context.Context, customContext *CustomContext) context.Context
- func WithCustomContextFromGinRequest(c *gin.Context, appSource string) context.Context
- func ZeroTime() time.Time
- type CustomContext
- type YearMonth
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseToNow ¶
func ConvertTimeToTimestampPtr ¶
func ConvertTimeToTimestampPtr(input *time.Time) *timestamppb.Timestamp
func FirstTimeOfMonth ¶
func GenerateMessageID ¶
generateMessageID creates a unique message ID for the email
func GetAppSourceFromContext ¶
func GetRolesFromContext ¶
func GetTenantFromContext ¶
func GetUserEmailFromContext ¶
func GetUserIdFromContext ¶
func IsAfter ¶
IsAfter compares two *time.Time, considering nil as far in the future. if both are nil return false
func IsEndOfMonth ¶
func IsEqualTimePtr ¶
IsEqualTimePtr compares two *time.Time values and returns true if both are nil or if both point to the same time.
func LastDayOfMonth ¶
func LastTimeOfMonth ¶
func MiddleTimeOfMonth ¶
func SetAppSourceInContext ¶
func SetTenantInContext ¶
func SetUserIdInContext ¶
func TimestampProtoToTime ¶
func TimestampProtoToTime(pbTime *timestamppb.Timestamp) time.Time
func TimestampProtoToTimePtr ¶
func TimestampProtoToTimePtr(pbTime *timestamppb.Timestamp) *time.Time
func ToDateAsAny ¶
func ValidateTenant ¶
func WithContext ¶
func WithContext(customContext *CustomContext, next http.Handler) http.Handler
func WithCustomContext ¶
func WithCustomContext(ctx context.Context, customContext *CustomContext) context.Context
Types ¶
type CustomContext ¶
type CustomContext struct {
AppSource string
Tenant string
AuthUserId string
UserId string
UserEmail string
Roles []string
}
func GetContext ¶
func GetContext(ctx context.Context) *CustomContext
Click to show internal directories.
Click to hide internal directories.