constants

package
v0.0.0-...-9058691 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinPasswordLen int    = 8
	MaxPasswordLen int    = 20
	AccessTokenKey string = "access_token"

	MinUsernameLen int = 4
	MaxUsernameLen int = 20

	MaxRoomLimit int = 10
)
View Source
const (
	BearerName     = "Bearer"
	BearerHeader   = "Authorization"
	AuthCtxUserKey = "user"
)
View Source
const (
	RandomTypeNumber byte = 1
	RandomTypeString byte = 2
)
View Source
const (
	ApiGroup        string = "/api"
	WsGroup         string = "/ws"
	DocSpecial      string = "/docs/*"
	DocCommon       string = "/docs"
	StaticGroupPath string = "/"
	StaticGroupName string = "public"
)
View Source
const (
	AuthGroupEndPoint      string = "/auth"
	SignUpEndPoint         string = "/signup"
	SignInEndPoint         string = "/signin"
	SignOutEndPoint        string = "/signout"
	ForgotPassword         string = "/forgot-password"
	VerifyResetPasswordOtp string = "/verify-reset-password-otp"
	ResetPassword          string = "/reset-password"
	UpdatePassword         string = "/update-password"
)
View Source
const (
	RoomGroupEndPoint      string = "/rooms"
	CreateRoomEndPoint     string = ""
	GetAllRoomsEndPoint    string = ""
	GetRoomsOfUserEndPoint string = "/:userId"
	GetChatHistoryEndPoint string = "/chat-history"
	GetContactListEndPoint string = "/contact-list"
)
View Source
const (
	CreateStreamEndPoint string = streamEndPoint + "/create"
	JoinStreamEndPoint   string = streamEndPoint + "/join"
)
View Source
const (
	ResourceGroupEndPoint string = "/resources"

	UploadSingleLocalResourceEndPoint   string = localResourceEndPoint + "/single"
	UploadMultipleLocalResourceEndPoint string = localResourceEndPoint + "/multiple"
	DeleteSingleLocalResourceEndPoint   string = localResourceEndPoint + "/single/:fileName"
	DeleteMultipleLocalResourceEndPoint string = localResourceEndPoint + "/multiple"
)
View Source
const (
	SearchGroupEndPoint string = "/search"
	SearchRoomEndPoint  string = "/room"
)
View Source
const (
	UserGroupEndPoint string = "/users"
	GetUserByIdOrName string = "/:idOrName"
)
View Source
const (
	CertPath string = "/.docker/nginx/cert.pem"
	KeyPath  string = "/.docker/nginx/key.pem"
)
View Source
const (
	EnvConfPath   string = ".env"
	ParamConfPath string = "conf"
)
View Source
const (
	UploadPath       string = "public/upload/"
	UploadPathReturn string = "/upload/"
	UploadPathInit   string = "public/upload"
)
View Source
const (
	RequestLogPath string = "logs/access.log"
	ErrorLogPath   string = "logs/errors.log"
	SystemLogPath  string = "logs/system.log"
)
View Source
const (
	ServerShutdown       string = "server is shutting down..."
	ServerExitedProperly string = "server is exited properly"
	ServerApiStarted     string = "api server is listening on PORT"
	ServerGotError       string = "got server error"
	ServerGotTerminate   string = "got terminate signal"
)
View Source
const (
	RedisConnectionSuccessful       string = "redis connection successful"
	PostgresConnectionSuccessful    string = "postgres connection successful"
	PostgresAutoMigrationSuccessful string = "postgres run auto migration successful"
	EMsgQueueName                          = "chat"
)
View Source
const (
	BucketName string = "zoomer"
)
View Source
const (
	ChatConnectEndPoint string = WsGroup + ""
)
View Source
const (
	Success string = "success"
)

Variables

View Source
var (
	ErrorShuttdownServer   error = errors.New("error shutting down server")
	ErrorStartHttps        error = errors.New("error occured when starting the server in HTTPS mode")
	ErrorStartHttp         error = errors.New("error occurred while starting the http api")
	ErrorSetupHttpRouter   error = errors.New("error occurred while setting up http routers")
	ErrorSetupSocketRouter error = errors.New("error occurred while setting up websocket routers")
	ErrorStartupApi        error = errors.New("error occurred while starting up the server")
	ErrorLoadEnvFile       error = errors.New("error loading env file")
	ErrorEnvKeyNotFound    error = errors.New("env key not found")
	ErrorContextTimeout    error = errors.New("error context timeout")
)
View Source
var (
	ErrorInternalServer      error = errors.New("we had a problem with our server. Try again later")
	ErrorBadRequest          error = errors.New("something went wrong")
	ErrorUnauthorized        error = errors.New("your API key is wrong. Try re-authenticating")
	ErrorForbidden           error = errors.New("you do not have permission to access this resource")
	ErrorNotFound            error = errors.New("the specified resource could not be found")
	ErrorMethodNotAllowed    error = errors.New("you tried to access a resource with an invalid method")
	ErrorNotAcceptable       error = errors.New("you requested a format that isn't json")
	ErrorUnprocessableEntity error = errors.New("your input failed validation")
	ErrorTooManyRequests     error = errors.New("too many requests")
	ErrorTimeout             error = errors.New("your request timed out")
	ErrorNoContent           error = errors.New("no content")
)
View Source
var (
	ErrorRedisConnectionFailed error = errors.New("redis connection failed")
	ErrRedisSyncUser           error = errors.New("error when sync user data to redis")
	ErrRedisAddUser            error = errors.New("error when add redis user data to redis")

	ErrorPostgresConnectionFailed error = errors.New("failed to connect to postgres database")
	ErrorPostgresGetResponse      error = errors.New("error when get ping response from postgres")
	ErrorPostgresReconnect        error = errors.New("error when reconnect to postgres")
	ErrorPostgresAutoMigration    error = errors.New("error when run auto migrate postgres")
)
View Source
var (
	ErrRequiredUUID error = errors.New("id is required")
	ErrInvalidUUID  error = errors.New("uuid is invalid")
)
View Source
var (
	ErrUserNotFound     error = errors.New("user not found")
	ErrUserExisted      error = errors.New("user existed")
	ErrReqiredUsername  error = errors.New("username is required")
	ErrLenUsername      error = errors.New("username must be between 4 and 20 characters")
	ErrAlphaNumUsername error = errors.New("username can only contain letters or numbers")
	ErrCreateUserFailed error = errors.New("create user failed")
	ErrSpaceUsername    error = errors.New("username is not allowed to have spaces")

	ErrRequiredEmail error = errors.New("email is required")
	ErrInvalidEmail  error = errors.New("email is invalid")
	ErrSpaceEmail    error = errors.New("email is not allowed to have spaces")
	ErrLenEmail      error = errors.New("email must be between 8 and 20 characters")

	ErrRequiredPassword  error = errors.New("password is required")
	ErrSpacePassword     error = errors.New("password is not allowed to have spaces")
	ErrLenPassword       error = errors.New("password must be between 8 and 32 characters")
	ErrAlphaNumPassword  error = errors.New("password must contain at least one letter - one number - one special characters - one uppercase letter - one lowercase letter")
	ErrHashPassword      error = errors.New("error when encrypt password")
	ErrComparePassword   error = errors.New("password not match")
	ErrPasswordNotChange error = errors.New("password must be different from the old password")

	ErrNoRecord           error = errors.New("no record")
	ErrInvalidAccessToken error = errors.New("invalid access token")
	ErrUnexpectedSigning  error = errors.New("unexpected signing method")
	ErrSigningKey         error = errors.New("signing key error")
	ErrParseToken         error = errors.New("parse token error")
)
View Source
var (
	// ErrOtpNotFound error = errors.New("otp not found")
	ErrOtpExpired error = errors.New("otp expired")
	ErrOtpInvalid error = errors.New("otp invalid")
)
View Source
var (
	// room
	ErrChatNotFound     error = errors.New("chat not found")
	ErrChatAccessDenied error = errors.New("chat access denied")
	ErrInvalidRoomLimit error = errors.New("room limit must be positive number")
	ErrMaxRoomLimit     error = errors.New("max room limit")
)
View Source
var (
	// stream
	ErrStreamIDMissing error = errors.New("roomID is missing")
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL