Documentation
¶
Index ¶
- Variables
- 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 ExtractDomainFromEmail(email string) string
- func FirstTimeOfMonth(year, month int) time.Time
- func GenerateKey(length int, includeSpecial bool) string
- func GenerateLowerAlpha(length int) string
- func GenerateMessageID(domain, metadata string) string
- func GenerateNanoID(length int) string
- func GenerateNanoIDWithPrefix(prefix string, length int) string
- func GetCurrentTimeInTimeZone(timezone string) time.Time
- func GetFileExtensionFromContentType(contentType string) string
- func GetOrDefault[T any](ptr *T, defaultVal T) T
- func GetTenantFromContext(ctx context.Context) string
- func GetUserEmailFromContext(ctx context.Context) string
- func GetUserIdFromContext(ctx context.Context) string
- func IntPtr(i int) *int
- func IsAfter(t1, t2 *time.Time) bool
- func IsEndOfMonth(t time.Time) bool
- func IsEqualTimePtr(t1, t2 *time.Time) bool
- func IsInFuture(timestamp time.Time) bool
- func IsStringInSlice(s string, slice []string) bool
- func LastDayOfMonth(year, month int) time.Time
- func LastTimeOfMonth(year, month int) time.Time
- func MiddleTimeOfMonth(year, month int) time.Time
- func NormalizeEmailSubject(subject string) string
- func NormalizeMessageID(messageID string) string
- func NormalizeSubject(subject string) string
- 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 SliceToString(slice []string) string
- func StartOfDayInUTC(t time.Time) time.Time
- func StringPtr(s string) *string
- func StringToSlice(str string) []string
- 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 UniqueEmails(emails []string) []string
- 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) context.Context
- func WithTenantContext(ctx context.Context, tenant string) context.Context
- func ZeroTime() time.Time
- type CustomContext
- type EventCompletedDetails
- type YearMonth
Constants ¶
This section is empty.
Variables ¶
View Source
var TenantHeaders = []string{
"X-TENANT",
"x-tenant",
"X-Tenant",
"tenant",
"Tenant",
"TENANT",
"tenantname",
"TenantName",
"tenantName",
"TENANTNAME",
}
TenantHeaders is a list of possible header names for tenant identification
View Source
var UserIdHeaders = []string{
"X-USER-ID",
"X-USERID",
"X-User-Id",
"X-UserId",
"X-User-ID",
"X-Userid",
"x-user-id",
"User-ID",
"UserId",
"Userid",
"USERID",
}
Functions ¶
func CloseToNow ¶
func ConvertTimeToTimestampPtr ¶
func ConvertTimeToTimestampPtr(input *time.Time) *timestamppb.Timestamp
func ExtractDomainFromEmail ¶ added in v0.0.23
func FirstTimeOfMonth ¶
func GenerateKey ¶ added in v0.0.3
func GenerateLowerAlpha ¶ added in v0.0.3
func GenerateMessageID ¶
generateMessageID creates a unique message ID for the email
func GenerateNanoID ¶ added in v0.0.3
func GetFileExtensionFromContentType ¶ added in v0.1.5
func GetOrDefault ¶ added in v0.1.6
func GetOrDefault[T any](ptr *T, defaultVal T) T
GetOrDefault returns the value if the pointer is not nil, otherwise returns the default value
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 IsInFuture ¶ added in v0.1.6
func IsStringInSlice ¶ added in v0.0.3
func LastDayOfMonth ¶
func LastTimeOfMonth ¶
func MiddleTimeOfMonth ¶
func NormalizeEmailSubject ¶ added in v0.0.3
normalizeSubject removes prefixes like Re:, Fwd:, etc. from a subject
func NormalizeMessageID ¶ added in v0.0.3
func NormalizeSubject ¶ added in v0.0.3
func SetAppSourceInContext ¶
func SetTenantInContext ¶
func SetUserIdInContext ¶
func SliceToString ¶ added in v0.0.3
func StringToSlice ¶ added in v0.0.3
func TimestampProtoToTime ¶
func TimestampProtoToTime(pbTime *timestamppb.Timestamp) time.Time
func TimestampProtoToTimePtr ¶
func TimestampProtoToTimePtr(pbTime *timestamppb.Timestamp) *time.Time
func ToDateAsAny ¶
func UniqueEmails ¶ added in v0.0.3
func ValidateTenant ¶
func WithContext ¶
func WithContext(customContext *CustomContext, next http.Handler) http.Handler
func WithCustomContext ¶
func WithCustomContext(ctx context.Context, customContext *CustomContext) context.Context
func WithTenantContext ¶ added in v0.0.21
WithTenantContext creates a new context with the specified tenant
Types ¶
type CustomContext ¶
func GetContext ¶
func GetContext(ctx context.Context) *CustomContext
type EventCompletedDetails ¶ added in v0.1.6
func NewEventCompletedDetails ¶ added in v0.1.6
func NewEventCompletedDetails() *EventCompletedDetails
func (*EventCompletedDetails) WithCreate ¶ added in v0.1.6
func (ecd *EventCompletedDetails) WithCreate() *EventCompletedDetails
func (*EventCompletedDetails) WithDelete ¶ added in v0.1.6
func (ecd *EventCompletedDetails) WithDelete() *EventCompletedDetails
func (*EventCompletedDetails) WithUpdate ¶ added in v0.1.6
func (ecd *EventCompletedDetails) WithUpdate() *EventCompletedDetails
Click to show internal directories.
Click to hide internal directories.