Documentation ¶
Index ¶
- Constants
- func AddMiddleware(h http.Handler, middleware ...func(http.Handler) http.Handler) http.Handler
- func AuthenticateMiddleware(next http.Handler) http.Handler
- func CheckRoles(AllowedRoles []string, UserRoles []string) error
- func ConvertToTime(createdAt *timestamp.Timestamp, updatedAt *timestamp.Timestamp) (time.Time, time.Time, error)
- func ConvertToTimestamp(createdAt time.Time, updatedAt time.Time) (*timestamp.Timestamp, *timestamp.Timestamp, error)
- func CorsMiddleware(next http.Handler) http.Handler
- func CreateCtxJWT(ctx context.Context) (context.Context, error)
- func DecodeCursor(cursor string) string
- func EncodeCursor(cursor uint32) string
- func GenTokenHash(requestID string) (selector, verifier, token string, err error)
- func GetAuthBearerToken(r *http.Request) (string, error)
- func GetClientCred(log *zap.Logger, isTest bool, pwd string, grpcServerOpt *GrpcServerOptions) (credentials.TransportCredentials, error)
- func GetConfigOpt(log *zap.Logger, v *viper.Viper) (*RedisOptions, *MailerOptions, *GrpcServerOptions, *OauthOptions, *UserOptions, ...)
- func GetHTTPRateLimiter(store *goredisstore.GoRedisStore, MaxRate int, MaxBurst int) throttled.HTTPRateLimiter
- func GetJWTFromCtx(ctx context.Context, header string) (string, error)
- func GetPathParts(url string) []string
- func GetPathQueryString(s string) (string, url.Values, error)
- func GetRequestID() string
- func GetSelectorForPasswdRecoveryToken(token string, requestID string) ([64]byte, string, error)
- func GetServices(log *zap.Logger, isTest bool, dbOpt *DBOptions, redisOpt *RedisOptions, ...) (*DBService, *RedisService, *MailerService)
- func GetSrvCred(log *zap.Logger, isTest bool, pwd string, grpcServerOpt *GrpcServerOptions) (credentials.TransportCredentials, error)
- func GetTimeDetails() time.Time
- func GetUUID() uuid.UUID
- func GetUUIDBytes() ([]byte, error)
- func GetViper() (*viper.Viper, error)
- func HashPassword(password string, requestID string) ([]byte, error)
- func LoadEnforcer(dbOpt *DBService, roleOpt *RoleOptions) (*casbin.Enforcer, error)
- func ParseTemplate(templateFileName string, data interface{}) (string, error)
- func ParseURL(urlString string) ([]string, url.Values, error)
- func RenderErrorJSON(w http.ResponseWriter, errorCode string, errorMsg string, httpStatusCode int, ...)
- func RenderJSON(w http.ResponseWriter, data interface{})
- func SetJWTOpt(jwt *JWTOptions)
- func SetUpLogging(logPath string) *zap.Logger
- func TimeToTimestamp(dateAt time.Time) (*timestamp.Timestamp, error)
- func TimestampToTime(dateAt *timestamp.Timestamp) (time.Time, error)
- func UUIDBytesToStr(b []byte) (string, error)
- func UUIDStrToBytes(s string) ([]byte, error)
- func UUIDStrToUUID(s string) (uuid.UUID, error)
- func ValidatePasswdRecoveryToken(verifierBytes [64]byte, verifier string, tokenExpiry time.Time, ...) error
- type ContextData
- type ContextStruct
- type DBIntf
- type DBOptions
- type DBService
- func (dbService *DBService) DBClose() error
- func (dbService *DBService) InsUpd(ctx context.Context, userEmail string, requestID string, ex execFunc) error
- func (dbService *DBService) QueryRow(ctx context.Context, userEmail string, requestID string, query string, ...) PartialQuery
- func (dbService *DBService) QueryRows(ctx context.Context, userEmail string, requestID string, query string, ...) PartialQuery
- type EachRowFunc
- type ElasticOptions
- type Email
- type Error
- type GrpcServerOptions
- type JWTOptions
- type JaegerTracerOptions
- type Key
- type LogOptions
- type MailerIntf
- type MailerOptions
- type MailerService
- func (mailerService *MailerService) SendChangeMail(hostURL string, userEmail string, newEmail string, resetToken string, ...) error
- func (mailerService *MailerService) SendConfirmationMail(hostURL string, userEmail string, emailConfirmationToken string, ...) error
- func (mailerService *MailerService) SendMail(msg Email) error
- func (mailerService *MailerService) SendResetPasswordMail(hostURL string, userEmail string, resetToken string, requestID string) error
- type OauthOptions
- type PartialQuery
- type PromOptions
- type RateOptions
- type RedisIntf
- type RedisOptions
- type RedisService
- type Role
- type RoleOptions
- type ScanFunc
- type ServerOptions
- type User
- type UserOptions
- type Validator
- func (v *Validator) Error() string
- func (v *Validator) IsAlpha(fieldName string, fieldValue string) bool
- func (v *Validator) IsAlphaNumeric(fieldName string, fieldValue string) bool
- func (v *Validator) IsCreditCard(fieldName string, fieldValue string) bool
- func (v *Validator) IsDateFormat(fieldName string, fieldValue string) bool
- func (v *Validator) IsDigits(fieldName string, fieldValue string) bool
- func (v *Validator) IsEmail(fieldName string, fieldValue string) bool
- func (v *Validator) IsGreaterThan(fieldName string, fieldValue, high int) bool
- func (v *Validator) IsInt64Negative(fieldName string, fieldValue int64) bool
- func (v *Validator) IsInt64NonNegative(fieldName string, fieldValue int64) bool
- func (v *Validator) IsInt64NonPositive(fieldName string, fieldValue int64) bool
- func (v *Validator) IsInt64Positive(fieldName string, fieldValue int64) bool
- func (v *Validator) IsPhoneNumber(fieldName string, fieldValue string) bool
- func (v *Validator) IsStrLenBetMinMax(fieldName string, fieldValue string, min int, max int) bool
- func (v *Validator) IsStrLenGtMin(fieldName string, fieldValue string, min int) bool
- func (v *Validator) IsStrLenLtMax(fieldName string, fieldValue string, max int) bool
- func (v *Validator) IsStrNotEmpty(fieldName string, fieldValue string) bool
- func (v *Validator) IsTimeBefore(fieldName string, fieldValue, max time.Time) bool
- func (v *Validator) IsUUID4(fieldName string, fieldValue string) bool
- func (v *Validator) IsValid() bool
- type ValidatorIntf
Constants ¶
const ( WorkspaceNameLenMin = 1 WorkspaceNameLenMax = 50 WorkspaceDescLenMin = 1 WorkspaceDescLenMax = 1000 )
For validation of workspace fields
const ( ChannelNameLenMin = 1 ChannelNameLenMax = 50 ChannelDescLenMin = 1 ChannelDescLenMax = 1000 )
For validation of Channel fields
const ( MtextLenMin = 1 MtextLenMax = 1000 )
For validation of Message fields
const ( FirstNameLenMin = 1 FirstNameLenMax = 100 LastNameLenMin = 1 LastNameLenMax = 100 PasswordLenMin = 6 PasswordLenMax = 50 )
For validation of user fields
const ( UgroupNameLenMin = 1 UgroupNameLenMax = 50 UgroupDescLenMin = 1 UgroupDescLenMax = 1000 )
For validation of Ugroup fields
const ( UbadgeNameLenMin = 1 UbadgeNameLenMax = 50 UbadgeDescLenMin = 1 UbadgeDescLenMax = 1000 )
For validation of Ubadge fields
const Active = 1
Active - value of status
const DBMysql string = "mysql"
DBMysql for DbType is mysql
const DBPgsql string = "pgsql"
DBPgsql for DbType is pgsql
const Inactive = 0
Inactive - value of status
const RPCReqTimeout = 10 * time.Second
RPCReqTimeout - value of request timeout
Variables ¶
This section is empty.
Functions ¶
func AddMiddleware ¶
AddMiddleware - adds middleware to a Handler
func AuthenticateMiddleware ¶
AuthenticateMiddleware - Authenticate Token from request
func CheckRoles ¶
CheckRoles - used for checking roles
func ConvertToTime ¶
func ConvertToTime(createdAt *timestamp.Timestamp, updatedAt *timestamp.Timestamp) (time.Time, time.Time, error)
ConvertToTime - used to convert timestamp to time.Time
func ConvertToTimestamp ¶
func ConvertToTimestamp(createdAt time.Time, updatedAt time.Time) (*timestamp.Timestamp, *timestamp.Timestamp, error)
ConvertToTimestamp - used to convert time.Time to timestamp
func CorsMiddleware ¶
CorsMiddleware - Enable CORS with various options
func CreateCtxJWT ¶
CreateCtxJWT - used to get context
func GenTokenHash ¶
GenTokenHash - GenTokenHash generates pieces needed for passwd recovery hash of the first half of a 64 byte value (to be stored in the database and used in SELECT query) verifier: hash of the second half of a 64 byte value (to be stored in database but never used in SELECT query) token: the user-facing base64 encoded selector+verifier
func GetAuthBearerToken ¶
GetAuthBearerToken - extract the BEARER token from the auth header
func GetClientCred ¶
func GetClientCred(log *zap.Logger, isTest bool, pwd string, grpcServerOpt *GrpcServerOptions) (credentials.TransportCredentials, error)
GetClientCred -- client credentials
func GetConfigOpt ¶
func GetConfigOpt(log *zap.Logger, v *viper.Viper) (*RedisOptions, *MailerOptions, *GrpcServerOptions, *OauthOptions, *UserOptions, *JaegerTracerOptions, *PromOptions, *RoleOptions)
GetConfigOpt -- Get db, redis, mailer, grpc, jwt, oauth, user, tracer, prometheus, elasticsearch options
func GetHTTPRateLimiter ¶
func GetHTTPRateLimiter(store *goredisstore.GoRedisStore, MaxRate int, MaxBurst int) throttled.HTTPRateLimiter
GetHTTPRateLimiter - Get HTTP Rate Limiter
func GetJWTFromCtx ¶
GetJWTFromCtx - used to get jwt from context
func GetPathParts ¶
GetPathParts - given a url, returns a slice of the parts of the url
func GetPathQueryString ¶
GetPathQueryString -- given url string, returns the path, and the query string Eg. "/v1/users?limit=5&cursor=s4R0Z6ecFTzTC4j=" will return "/v1/users", ["limit"]="5", ["cursor"]="s4R0Z6ecFTzTC4j="
func GetSelectorForPasswdRecoveryToken ¶
GetSelectorForPasswdRecoveryToken - Get Selector For Password Recovery Token
func GetServices ¶
func GetServices(log *zap.Logger, isTest bool, dbOpt *DBOptions, redisOpt *RedisOptions, mailerOpt *MailerOptions) (*DBService, *RedisService, *MailerService)
GetServices - Init Db, Redis, and Mailer services
func GetSrvCred ¶
func GetSrvCred(log *zap.Logger, isTest bool, pwd string, grpcServerOpt *GrpcServerOptions) (credentials.TransportCredentials, error)
GetSrvCred -- server credentials
func GetTimeDetails ¶
GetTimeDetails - used to populate created_by and updated_by fields when inserting/updating records in the database
func GetUUIDBytes ¶
GetUUIDBytes - used for UUID generation, to save in the db
func HashPassword ¶
HashPassword - Generate hash password
func LoadEnforcer ¶
func LoadEnforcer(dbOpt *DBService, roleOpt *RoleOptions) (*casbin.Enforcer, error)
LoadEnforcer - used for checking roles
func ParseTemplate ¶
ParseTemplate - used for parsing template (for emails)
func ParseURL ¶
ParseURL - parses a url into a slice (GetPathParts) and the query string (GetPathQueryString)
func RenderErrorJSON ¶
func RenderErrorJSON(w http.ResponseWriter, errorCode string, errorMsg string, httpStatusCode int, requestID string)
RenderErrorJSON - send error JSON response
func RenderJSON ¶
func RenderJSON(w http.ResponseWriter, data interface{})
RenderJSON - send JSON response
func TimeToTimestamp ¶
TimeToTimestamp - used to convert time.Time to timestamp
func TimestampToTime ¶
TimestampToTime - used to convert timestamp to time.Time
func UUIDBytesToStr ¶
UUIDBytesToStr - convert a UUID retrieved from the DB as str, to string for sending to the client
func UUIDStrToBytes ¶
UUIDStrToBytes - convert a UUID str into bytes
func UUIDStrToUUID ¶
UUIDStrToUUID - convert a UUID str into UUID
Types ¶
type ContextData ¶
ContextData - details of a user stored in the Redis cache
type ContextStruct ¶
ContextStruct - stored in the request context set in AuthMiddleware
func GetAuthData ¶
func GetAuthData(r *http.Request) ContextStruct
GetAuthData - used to get auth details
type DBOptions ¶
type DBOptions struct { DB string `mapstructure:"db"` Host string `mapstructure:"hostname"` Port string `mapstructure:"port"` User string `mapstructure:"user"` Password string `mapstructure:"password"` Schema string `mapstructure:"db_schema"` LimitSQLRows string `mapstructure:"limit_sql_rows"` MySQLTestFilePath string `mapstructure:"mysql_test_file_path"` MySQLSchemaFilePath string `mapstructure:"mysql_schema_file_path"` MySQLTruncateFilePath string `mapstructure:"mysql_truncate_file_path"` PgSQLTestFilePath string `mapstructure:"pgsql_test_file_path"` PgSQLSchemaFilePath string `mapstructure:"pgsql_schema_file_path"` PgSQLTruncateFilePath string `mapstructure:"pgsql_truncate_file_path"` }
DBOptions - for db config
func GetDbConfig ¶
func GetDbConfig(log *zap.Logger, v *viper.Viper, isTest bool, db string, dbHost string, dbPort string, dbUser string, dbPassword string, dbSchema string, dbMysqlTestFilePath string, dbMysqlSchemaFilePath string, dbMysqlTruncateFilePath string, dbPgsqlTestFilePath string, dbPgsqlSchemaFilePath string, dbPgsqlTruncateFilePath string) (*DBOptions, error)
GetDbConfig -- read DB config options
type DBService ¶
type DBService struct { DBType string DB *sql.DB Schema string LimitSQLRows string MySQLTestFilePath string MySQLSchemaFilePath string MySQLTruncateFilePath string PgSQLTestFilePath string PgSQLSchemaFilePath string PgSQLTruncateFilePath string // contains filtered or unexported fields }
DBService - Database type and Pointer to access Db
func CreateDBService ¶
CreateDBService -- init DB
func NewDBService ¶
NewDBService - get connection to DB and create a DBService struct
func (*DBService) InsUpd ¶
func (dbService *DBService) InsUpd(ctx context.Context, userEmail string, requestID string, ex execFunc) error
InsUpd - Insert, Update to database
type ElasticOptions ¶
type ElasticOptions struct { User string `mapstructure:"username"` Password string `mapstructure:"password"` ServerAddr string `mapstructure:"server_addr"` IndexName string `mapstructure:"index_name"` }
ElasticOptions - for ElasticSearch config
type Error ¶
type Error struct { ErrorCode string `json:"error_code"` ErrorMsg string `json:"error_msg"` HTTPStatusCode int `json:"status"` RequestID string `json:"request_id"` }
Error - used for
type GrpcServerOptions ¶
type GrpcServerOptions struct { GrpcWorkspaceServerPort string `mapstructure:"grpc_workspace_server_port"` GrpcChannelServerPort string `mapstructure:"grpc_channel_server_port"` GrpcMessageServerPort string `mapstructure:"grpc_message_server_port"` GrpcUserServerPort string `mapstructure:"grpc_user_server_port"` GrpcUbadgeServerPort string `mapstructure:"grpc_ubadge_server_port"` GrpcUgroupServerPort string `mapstructure:"grpc_ugroup_server_port"` GrpcSearchServerPort string `mapstructure:"grpc_search_server_port"` GrpcCaCertPath string `mapstructure:"grpc_ca_cert_path"` GrpcCertPath string `mapstructure:"grpc_cert_path"` GrpcKeyPath string `mapstructure:"grpc_key_path"` }
GrpcServerOptions - for grpc server config
func GetGrpcServerConfig ¶
GetGrpcServerConfig -- read grpc server config options
type JWTOptions ¶
JWTOptions - for JWT config
type JaegerTracerOptions ¶
type JaegerTracerOptions struct { WorkspaceServiceName string `mapstructure:"workspace_service_name"` ChannelServiceName string `mapstructure:"channel_service_name"` MessageServiceName string `mapstructure:"message_service_name"` UbadgeServiceName string `mapstructure:"ubadge_service_name"` UgroupServiceName string `mapstructure:"ugroup_service_name"` UserServiceName string `mapstructure:"user_service_name"` SearchServiceName string `mapstructure:"search_service_name"` UserAgent string `mapstructure:"user_agent"` }
JaegerTracerOptions - for Jaeger Tracer config
func GetJaegerTracerConfig ¶
GetJaegerTracerConfig -- read JaegerTracer config options
type Key ¶
type Key string
Key - type of the key used in the request context
const KeyEmailToken Key = "emailtoken"
KeyEmailToken - used for the request context key
type LogOptions ¶
type LogOptions struct { Path string `mapstructure:"log_file_path"` WorkspacePath string `mapstructure:"log_workspace_file_path"` ChannelPath string `mapstructure:"log_channel_file_path"` MessagePath string `mapstructure:"log_message_file_path"` UbadgePath string `mapstructure:"log_ubadge_file_path"` UgroupPath string `mapstructure:"log_ugroup_file_path"` UserPath string `mapstructure:"log_user_file_path"` SearchPath string `mapstructure:"log_search_file_path"` Level string `mapstructure:"log_level"` }
LogOptions - for logging
func GetLogConfig ¶
func GetLogConfig(v *viper.Viper) (*LogOptions, error)
GetLogConfig -- read log config options
type MailerIntf ¶
type MailerIntf interface { SendConfirmationMail(hostURL string, userEmail string, emailConfirmationToken string, requestID string) error SendResetPasswordMail(hostURL string, userEmail string, resetToken string, requestID string) error SendChangeMail(hostURL string, userEmail string, newEmail string, resetToken string, requestID string) error SendMail(msg Email) error }
MailerIntf interface to the Mailer
type MailerOptions ¶
type MailerOptions struct { User string `mapstructure:"username"` Password string `mapstructure:"password"` Port int `mapstructure:"port"` Server string `mapstructure:"server"` }
MailerOptions - for mailer config
func GetMailerConfig ¶
GetMailerConfig -- read mailer config options
type MailerService ¶
MailerService Pointer to mailer
func CreateMailerService ¶
func CreateMailerService(log *zap.Logger, mailerOpt *MailerOptions) (*MailerService, error)
CreateMailerService -- init mailer
func NewMailerService ¶
func NewMailerService(log *zap.Logger, mailerOpt *MailerOptions) (*MailerService, error)
NewMailerService get connection to mailer and create a MailerService struct
func (*MailerService) SendChangeMail ¶
func (mailerService *MailerService) SendChangeMail(hostURL string, userEmail string, newEmail string, resetToken string, requestID string) error
SendChangeMail - used for sending change email
func (*MailerService) SendConfirmationMail ¶
func (mailerService *MailerService) SendConfirmationMail(hostURL string, userEmail string, emailConfirmationToken string, requestID string) error
SendConfirmationMail - used for sending confirmation email
func (*MailerService) SendMail ¶
func (mailerService *MailerService) SendMail(msg Email) error
SendMail - used for sending email
func (*MailerService) SendResetPasswordMail ¶
func (mailerService *MailerService) SendResetPasswordMail(hostURL string, userEmail string, resetToken string, requestID string) error
SendResetPasswordMail - used for sending reset password email
type OauthOptions ¶
type OauthOptions struct { ClientID string `mapstructure:"client_id"` ClientSecret string `mapstructure:"client_secret"` }
OauthOptions - for oauth config
func GetOauthConfig ¶
GetOauthConfig -- read oauth config options
type PartialQuery ¶
type PartialQuery func(row EachRowFunc) error
PartialQuery - function to drive the loop
type PromOptions ¶
type PromOptions struct { PromHTTPWorkspaceServerPort string `mapstructure:"prom_http_workspace_server_port"` PromHTTPChannelServerPort string `mapstructure:"prom_http_channel_server_port"` PromHTTPMessageServerPort string `mapstructure:"prom_http_message_server_port"` PromHTTPUserServerPort string `mapstructure:"prom_http_user_server_port"` PromHTTPUbadgeServerPort string `mapstructure:"prom_http_ubadge_server_port"` PromHTTPUgroupServerPort string `mapstructure:"prom_http_ugroup_server_port"` PromHTTPSearchServerPort string `mapstructure:"prom_http_search_server_port"` }
PromOptions - for Prometheus config
func GetPromConfig ¶
GetPromConfig -- read Prometheus config options
type RateOptions ¶
type RateOptions struct { UserMaxRate int `mapstructure:"user_max_rate"` UserMaxBurst int `mapstructure:"user_max_burst"` UgroupMaxRate int `mapstructure:"ugroup_max_rate"` UgroupMaxBurst int `mapstructure:"ugroup_max_burst"` WorkspaceMaxRate int `mapstructure:"workspace_max_rate"` WorkspaceMaxBurst int `mapstructure:"workspace_max_burst"` ChannelMaxRate int `mapstructure:"channel_max_rate"` ChannelMaxBurst int `mapstructure:"channel_max_burst"` MsgMaxRate int `mapstructure:"msg_max_rate"` MsgMaxBurst int `mapstructure:"msg_max_burst"` UbadgeMaxRate int `mapstructure:"ubadge_max_rate"` UbadgeMaxBurst int `mapstructure:"ubadge_max_burst"` SearchMaxRate int `mapstructure:"search_max_rate"` SearchMaxBurst int `mapstructure:"search_max_burst"` UMaxRate int `mapstructure:"u_max_rate"` UMaxBurst int `mapstructure:"u_max_burst"` }
RateOptions - for rate limiting requests
func GetRateConfig ¶
GetRateConfig -- read rate config options
type RedisIntf ¶
type RedisIntf interface { Get(key string) (string, error) Set(key string, value interface{}, expiration time.Duration) error }
RedisIntf Interface to Redis commands All redis command to be called using this interface
type RedisOptions ¶
type RedisOptions struct {
Addr string `mapstructure:"addr"`
}
RedisOptions - for redis config
func GetRedisConfig ¶
GetRedisConfig -- read redis config options
type RedisService ¶
RedisService - Redis Pointer to redis
func CreateRedisService ¶
func CreateRedisService(log *zap.Logger, redisOpt *RedisOptions) (*RedisService, error)
CreateRedisService -- init redis
func NewRedisService ¶
func NewRedisService(log *zap.Logger, redisOpt *RedisOptions) (*RedisService, error)
NewRedisService get connection to redis and create a RedisService struct
type Role ¶
type Role struct { PType string `mapstructure:"ptype"` V0 string `mapstructure:"v0"` V1 string `mapstructure:"v1"` V2 string `mapstructure:"v2"` V3 string `mapstructure:"v3"` V4 string `mapstructure:"v4"` V5 string `mapstructure:"v5"` }
Role - for user roles
type RoleOptions ¶
type RoleOptions struct { Roles []Role `mapstructure:"roles"` RolesPolicyConfigPath string RolesTableName string `mapstructure:"roles_table"` }
RoleOptions - for Role
func GetRoleConfig ¶
GetRoleConfig -- read Roles config options
type ServerOptions ¶
type ServerOptions struct { ServerAddr string `mapstructure:"server_addr"` ServerTLS string `mapstructure:"server_tls"` CaCertPath string `mapstructure:"ca_cert_path"` CertPath string `mapstructure:"cert_path"` KeyPath string `mapstructure:"key_path"` }
ServerOptions - for server config
func GetServerConfig ¶
GetServerConfig -- read server config options
type UserOptions ¶
type UserOptions struct { ConfirmTokenDuration string `mapstructure:"confirm_token_duration"` ResetTokenDuration string `mapstructure:"reset_token_duration"` }
UserOptions - for user login
func GetUserConfig ¶
GetUserConfig -- read user config options
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator used for validation
func (*Validator) IsAlphaNumeric ¶
IsAlphaNumeric validate alpha numeric characters
func (*Validator) IsCreditCard ¶
IsCreditCard validate credit card
func (*Validator) IsDateFormat ¶
IsDateFormat validate date format
func (*Validator) IsGreaterThan ¶
IsGreaterThan int comparison
func (*Validator) IsInt64Negative ¶
IsInt64Negative returns true if value < 0
func (*Validator) IsInt64NonNegative ¶
IsInt64NonNegative returns true if value >= 0
func (*Validator) IsInt64NonPositive ¶
IsInt64NonPositive returns true if value <= 0
func (*Validator) IsInt64Positive ¶
IsInt64Positive returns true if value > 0
func (*Validator) IsPhoneNumber ¶
IsPhoneNumber validate phone number
func (*Validator) IsStrLenBetMinMax ¶
IsStrLenBetMinMax string length between min max
func (*Validator) IsStrLenGtMin ¶
IsStrLenGtMin string length greater than min
func (*Validator) IsStrLenLtMax ¶
IsStrLenLtMax string length less than max
func (*Validator) IsStrNotEmpty ¶
IsStrNotEmpty string not empty
func (*Validator) IsTimeBefore ¶
IsTimeBefore time comparison
type ValidatorIntf ¶
type ValidatorIntf interface { IsGreaterThan(fieldName string, fieldValue, high int) bool IsTimeBefore(fieldName string, fieldValue, max time.Time) bool IsStrNotEmpty(fieldName string, fieldValue string) bool IsInt64Negative(fieldName string, fieldValue int64) bool IsInt64NonNegative(fieldName string, fieldValue int64) bool IsInt64Positive(fieldName string, fieldValue int64) bool IsInt64NonPositive(fieldName string, fieldValue int64) bool IsEmail(fieldName string, fieldValue string) bool IsDateFormat(fieldName string, fieldValue string) bool IsPhoneNumber(fieldName string, fieldValue string) bool IsUUID4(fieldName string, fieldValue string) bool IsAlpha(fieldName string, fieldValue string) bool IsAlphaNumeric(fieldName string, fieldValue string) bool IsDigits(fieldName string, fieldValue string) bool IsCreditCard(fieldName string, fieldValue string) bool IsStrLenGtMin(fieldName string, fieldValue string, min int) bool IsStrLenLtMax(fieldName string, fieldValue string, max int) bool IsStrLenBetMinMax(fieldName string, fieldValue string, min int, max int) bool IsValid() bool Error() string }
ValidatorIntf interface for Validator