Improved documentation on the remaining OnXXX functions for custom objects

This commit is contained in:
mariusor 2022-03-22 11:47:50 +01:00
parent 2d4ccbceb8
commit fd7ce7b1fb
No known key found for this signature in database
GPG key ID: DBF5E47F5DBC4D21
4 changed files with 20 additions and 0 deletions

View file

@ -280,6 +280,11 @@ func ToPlace(it Item) (*Place, error) {
type withPlaceFn func(*Place) error
// OnPlace calls function fn on it Item if it can be asserted to type *Place
//
// This function should be called if trying to access the Place specific properties
// like "accuracy", "altitude", "latitude", "longitude", "radius", or "units".
// For the other properties OnObject should be used instead.
func OnPlace(it Item, fn withPlaceFn) error {
if it == nil {
return nil

View file

@ -248,6 +248,11 @@ func ToProfile(it Item) (*Profile, error) {
type withProfileFn func(*Profile) error
// OnProfile calls function fn on it Item if it can be asserted to type *Profile
//
// This function should be called if trying to access the Profile specific properties
// like "describes".
// For the other properties OnObject should be used instead.
func OnProfile(it Item, fn withProfileFn) error {
if it == nil {
return nil

View file

@ -263,6 +263,11 @@ func ToRelationship(it Item) (*Relationship, error) {
type withRelationshipFn func(*Relationship) error
// OnRelationship calls function fn on it Item if it can be asserted to type *Relationship
//
// This function should be called if trying to access the Relationship specific properties
// like "subject", "object", or "relationship".
// For the other properties OnObject should be used instead.
func OnRelationship(it Item, fn withRelationshipFn) error {
if it == nil {
return nil

View file

@ -254,6 +254,11 @@ func ToTombstone(it Item) (*Tombstone, error) {
type withTombstoneFn func(*Tombstone) error
// OnTombstone calls function fn on it Item if it can be asserted to type *Tombstone
//
// This function should be called if trying to access the Tombstone specific properties
// like "formerType" or "deleted".
// For the other properties OnObject should be used instead.
func OnTombstone(it Item, fn withTombstoneFn) error {
if it == nil {
return nil