Improved documentation on the remaining OnXXX functions for custom objects
This commit is contained in:
parent
2d4ccbceb8
commit
fd7ce7b1fb
5
place.go
5
place.go
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in a new issue