Documentation
¶
Index ¶
- func GenerateToken(username string, duration time.Duration, secret string) (uuid.UUID, string, pgtype.Timestamptz, error)
- func GrpcLogger(ctx context.Context, req any, info *grpc.UnaryServerInfo, ...) (resp any, err error)
- func HashPassword(password string) (string, error)
- func HttpLogger(handler http.Handler) http.Handler
- func IsPasswordValid(password, hashedPassword string) bool
- func ValidateEmail(value string) error
- func ValidateEmailId(value int64) error
- func ValidateFullName(value string) error
- func ValidatePassword(value string) error
- func ValidateSecretCode(value string) error
- func ValidateString(value string, minLength int, maxLength int) error
- func ValidateUsername(value string) error
- func VerifyToken(token, secret string) (uuid.UUID, string, error)
- type Config
- type EmailSender
- type GmailSender
- type ResponseRecorder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateToken ¶
func GrpcLogger ¶
func GrpcLogger(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error)
func HashPassword ¶
func IsPasswordValid ¶
func ValidateEmail ¶
func ValidateEmailId ¶
func ValidateFullName ¶
func ValidatePassword ¶
func ValidateSecretCode ¶
func ValidateUsername ¶
Types ¶
type Config ¶
type Config struct { Env string `mapstructure:"Env"` DBDriver string `mapstructure:"DB_DRIVER"` DBSource string `mapstructure:"DB_SOURCE"` DBMigrationURL string `mapstructure:"DB_MIGRATION_URL"` HTTP_Port string `mapstructure:"HTTP_PORT"` GRPC_Port string `mapstructure:"GRPC_PORT"` Redis_Port string `mapstructure:"REDIS_PORT"` Secret string `mapstructure:"SECRET"` TokenDuration time.Duration `mapstructure:"TOKEN_DURATION"` RefereshTokenDuration time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"` EmailSenderName string `mapstructure:"EMAIL_SENDER_NAME"` EmailSenderAddress string `mapstructure:"EMAIL_SENDER_ADDRESS"` EmailSenderPassword string `mapstructure:"EMAIL_SENDER_PASSWORD"` }
func LoadConfig ¶
type EmailSender ¶
type EmailSender interface {
SendEmail(subject string, content string, to []string, cc []string, bcc []string, attachFiles []string) error
}
func NewGmailSender ¶
func NewGmailSender(name string, fromEmailAddress string, fromEmailPassword string) EmailSender
type GmailSender ¶
type GmailSender struct {
// contains filtered or unexported fields
}
type ResponseRecorder ¶
type ResponseRecorder struct { http.ResponseWriter StatusCode int Body []byte }
func (*ResponseRecorder) WriteHeader ¶
func (rec *ResponseRecorder) WriteHeader(statusCode int)
Click to show internal directories.
Click to hide internal directories.