mirror of
https://github.com/Luzifer/sii.git
synced 2024-12-20 16:11:17 +00:00
Create reference from volatile company to city
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
719e6eab6a
commit
8b75fde904
1 changed files with 11 additions and 0 deletions
|
@ -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]}, ".")}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue