Skip to content

Instantly share code, notes, and snippets.

View apzuk3's full-sized avatar

Aram apzuk3

  • snyk
  • London
View GitHub Profile
@apzuk3
apzuk3 / main.go
Last active August 18, 2019 11:39
DevOps preparation sample code
package main
import (
"flag"
"fmt"
"os"
"net/http"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
@apzuk3
apzuk3 / validation_rules.go
Last active October 17, 2022 18:51
Validation rules
package main
import "fmt"
type User struct {
Email string `json:"email" validate:"required,email"`
Name string `json:"name" validate:"required,min=2,max=100"`
}
func main() {
@apzuk3
apzuk3 / junior_goper.go
Last active March 28, 2019 19:49
Input validation in GoLang junior approach
package user
const regexpEmail = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
type User struct {
Email string
Name string
}
func (a User) IsValid() (errs url.Values) {