Back to course

Structs: Organizing Data

Go (Golang) for Cloud-Native Microservices

Data Modeling with Structs

Go doesn't have classes. It has structs. A struct is a collection of fields.

go type User struct { ID int Name string Email string }

You can also tag them for JSON (crucial for APIs): go type User struct { Name string json:"user_name" }