Structs
Creating
// Since it is not Uppercase, it is only available inside the package
type user struct {
name string
email string
}Nesting structs
type system struct {
date string
user user
}Struct tags
type system struct {
Date string `json:"date"`
User user `json:"user_data"`
}Assiging values
Struct Literal or Composite Literal
Access property values
Structs as parameters
Struct Methods
Mutating struct values
constructors
Isolating them in packages
Following object oriented principles
Struct embedding
Define anonymously
Define with a specific name
Last updated