1
0
Fork 0
mirror of https://github.com/Luzifer/sii.git synced 2024-10-18 05:14:19 +00:00

Create reference from volatile company to city

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-12-24 15:47:35 +01:00
parent 719e6eab6a
commit 8b75fde904
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -1,5 +1,7 @@
package sii package sii
import "strings"
func init() { func init() {
RegisterBlock(&Company{}) RegisterBlock(&Company{})
} }
@ -23,3 +25,12 @@ func (c *Company) Init(class, name string) {
} }
func (c Company) Name() string { return c.blockName } func (c Company) Name() string { return c.blockName }
func (c Company) CityPtr() *Ptr {
nameParts := strings.Split(c.Name(), ".")
if len(nameParts) != 4 || nameParts[0] != "company" || nameParts[1] != "volatile" {
return nil
}
return &Ptr{Target: strings.Join([]string{"city", nameParts[3]}, ".")}
}