Golang: Declarative Validation Made Similar to Ruby on Railsby@tiago-melo
1,287 reads
1,287 reads

Golang: Declarative Validation Made Similar to Ruby on Rails

by Tiago Melo23mApril 27th, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Golang: Declarative Validation Made Similar to Ruby on Rails in a similar way to Active Record validations. The 'People' table has a One To Many relationship with 'Addresses' table. For private individuals, 'cpf' is required; for legal entities, 'cnpj' must be a valid one. For addresses, 'treet', 'city' and 'phone' are required fields; 'name' must have at least one address. For people, 'cnnj' should be not possible to have both CPf and cnnj fulfilled.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Golang: Declarative Validation Made Similar to Ruby on Rails
Tiago Melo HackerNoon profile picture
Tiago Melo

Tiago Melo

@tiago-melo

Senior Software Engineer

About @tiago-melo
LEARN MORE ABOUT @TIAGO-MELO'S
EXPERTISE AND PLACE ON THE INTERNET.

Share Your Thoughts

About Author

Tiago Melo HackerNoon profile picture
Tiago Melo@tiago-melo
Senior Software Engineer

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
L O A D I N G
. . . comments & more!