You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Boolean returns use Is/Has/Can prefix: IsValid, HasPermission
// Recommendedfunc (s*UserService) Register(req*RegisterRequest) (*User, error)
func (s*UserService) GetUserByID(iduint) (*User, error)
func (s*UserService) IsEmailExists(emailstring) bool// Not recommendedfunc (s*UserService) register_user()
func (s*UserService) get_user_by_id()
func (s*UserService) CheckEmailExists() // Should use Is/Has
7. Constant Naming
CamelCase: const MaxRetryCount = 3
Enum constants: const StatusActive = "active"
// Recommendedconst (
StatusActive="1"StatusInactive="0"MaxRetryCount=3
)
// Not recommendedconst (
STATUS_ACTIVE="1"// Not all uppercasestatus_active="1"// Not all lowercase
)