... | ... | @@ -91,6 +91,38 @@ Adding a more descriptive name to the `Subnet` structure can be tempting, but le |
|
|
|
|
|
It is ok to have the same structure name in multiple packages because the package names differ. For example, we already have `keaconfig.Subnet` and `dbmodel.Subnet`. The structure name is the same but they are two different objects.
|
|
|
|
|
|
## Getters and Setters
|
|
|
|
|
|
We require that getters and setters in Stork include the `Get` and `Set` prefixes. Even though the Effective Go document explicitly says that these prefixes are neither idiomatic nor required, we decided to use them because they make clear distinction between the getters and setters. Also, that's the naming convention used in other ISC projects.
|
|
|
|
|
|
For example, declare your getter function like this:
|
|
|
|
|
|
```golang
|
|
|
func (subnet *Subnet) GetID() int64 {
|
|
|
return subnet.id
|
|
|
}
|
|
|
```
|
|
|
|
|
|
rather than:
|
|
|
|
|
|
```golang
|
|
|
func (subnet *Subnet) ID() int64 {
|
|
|
return subnet.id
|
|
|
}
|
|
|
```
|
|
|
|
|
|
Declare your setter function like this:
|
|
|
|
|
|
```golang
|
|
|
func (subnet *Subnet) SetID(int64)
|
|
|
```
|
|
|
|
|
|
rather than:
|
|
|
|
|
|
```golang
|
|
|
func (subnet *Subnet) ID(int64)
|
|
|
```
|
|
|
|
|
|
# TypeScript Style
|
|
|
|
|
|
Used by UI. Details TBD
|
... | ... | |