Documentation ¶
Index ¶
- Constants
- func ToExpression(p Path, this uuid.UUID) string
- type Path
- func (p Path) Convert() string
- func (p Path) ConvertToLtree(id uuid.UUID) string
- func (p Path) IsEmpty() bool
- func (p Path) MarshalJSON() ([]byte, error)
- func (p Path) Parent() Path
- func (p Path) Root() Path
- func (p *Path) Scan(value interface{}) error
- func (p Path) String() string
- func (p Path) This() uuid.UUID
- func (p *Path) UnmarshalJSON(b []byte) error
- func (p Path) Value() (driver.Value, error)
Constants ¶
const ( SepInService = "/" SepInDatabase = "." )
Following constants are used while saving and displaying Path type to and from database
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Path ¶
Path type helps in storing and retrieving ltree fields to and from databse. It uses ltree knowledge while converting values. https://www.postgresql.org/docs/9.1/static/ltree.html It is just slice of UUIDs which will be saved to database in following format 4dd8f038_3fc4_48ab_ad4d_197ccc7b44a2.62ea5454_f8d5_4b35_8589_8d646d612250.c9b24b8f_8b33_4c22_82f0_8eb0a5b9837e Above content will be read from database as a slice of UUIDs
func (Path) Convert ¶
Convert returns ltree compatible string of UUID slice 39fa8c5b_5732_436f_a084_0f2a247f3435.87762c8b_17f9_4cbb_b355_251b6a524f2f
func (Path) ConvertToLtree ¶
ConvertToLtree returns ltree form of given UUID
func (Path) MarshalJSON ¶
MarshalJSON allows Path to be serialized
func (Path) Parent ¶
Parent returns a Path instance with last element in the UUID slice Similar to `This` but following funtion returns Path instance and not just UUID
func (Path) String ¶
String converts the Path to representable format in string Currently separator is '/' /87762c8b-17f9-4cbb-b355-251b6a524f2f/39fa8c5b-5732-436f-a084-0f2a247f3435/be54f2c4-cfa4-47af-ad06-280fba540872
func (*Path) UnmarshalJSON ¶
UnmarshalJSON allows Path to be deserialized