Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

Exported methods from unexported embedded struct #25

Closed
jmcvetta opened this issue Jul 17, 2012 · 2 comments
Closed

Exported methods from unexported embedded struct #25

jmcvetta opened this issue Jul 17, 2012 · 2 comments

Comments

@jmcvetta
Copy link
Contributor

Exported methods attached to an unexported embedded struct are not shown.
For example, consider package neo4j. Types Node and Relationship contain an embedded neoEntity struct. The neoEntity type itself is not exported. However many exported methods are attached to the embedded neoEntity struct, and are thus exported from the final Node and Relationship types.

The methods in question are for sure exported - they can be accessed from code that imports the package, and they are shown in the output of go doc.

GoPkgDoc shows only a few methods on Node and Relationship. Yet go doc's output shows many more:


package neo4j
    import "github.com/jmcvetta/neo4j"

    Package neo4j provides a client for the Neo4j graph database.

VARIABLES

var (
    BadResponse        = errors.New("Bad response from Neo4j server.")
    NotFound           = errors.New("Cannot find in database.")
    FeatureUnavailable = errors.New("Feature unavailable")
    CannotDelete       = errors.New("The node cannot be deleted. Check that the node is orphaned before deletion.")
)


TYPES

type Database struct {
    // contains filtered or unexported fields
}
    A Database is a REST client connected to a Neo4j database.

func NewDatabase(uri string) (db *Database, err error)

func (db *Database) CreateNode(p Properties) (*Node, error)
    CreateNode creates a Node in the database.

func (db *Database) GetNode(id int) (*Node, error)
    GetNode fetches a Node from the database

func (db *Database) GetRelationship(id int) (*Relationship, error)
    GetRelationship fetches a Relationship from the DB by id.

func (db *Database) RelationshipTypes() ([]string, error)
    RelationshipTypes gets all existing relationship types from the DB

type Node struct {
    // contains filtered or unexported fields
}
    A node in a Neo4j database

func (e *Node) Delete() error
    Delete removes the object from the DB.

func (e *Node) DeleteProperties() error
    DeleteProperties deletes all properties.

func (e *Node) DeleteProperty(key string) error
    DeleteProperty deletes property key

func (e *Node) GetProperty(key string) (string, error)
    GetProperty fetches the value of property key.

func (n *Node) Id() int
    Id gets the ID number of this Node.

func (n *Node) Incoming(types ...string) (map[int]Relationship, error)
    Incoming gets all incoming Relationships for this Node.

func (n *Node) Outgoing(types ...string) (map[int]Relationship, error)
    Outgoing gets all outgoing Relationships for this Node.

func (e *Node) Properties() (Properties, error)
    Properties fetches all properties

func (n *Node) Relate(relType string, destId int, p Properties) (*Relationship, error)
    Relate creates a relationship of relType, with specified properties,
    from this Node to the node identified by destId.

func (n *Node) Relationships(types ...string) (map[int]Relationship, error)
    Relationships gets all Relationships for this Node, optionally filtered
    by type, returning them as a map keyed on Relationship ID.

func (e *Node) SetProperties(p Properties) error
    SetProperties updates all properties, overwriting any existing
    properties.

func (e *Node) SetProperty(key string, value string) error
    SetProperty sets the single property key to value.

type Properties map[string]string
    Properties is a bag of key/value pairs that can describe Nodes and
    Relationships.

type Relationship struct {
    // contains filtered or unexported fields
}
    A relationship in a Neo4j database

func (e *Relationship) Delete() error
    Delete removes the object from the DB.

func (e *Relationship) DeleteProperties() error
    DeleteProperties deletes all properties.

func (e *Relationship) DeleteProperty(key string) error
    DeleteProperty deletes property key

func (r *Relationship) End() (*Node, error)
    End gets the ending Node of this Relationship.

func (e *Relationship) GetProperty(key string) (string, error)
    GetProperty fetches the value of property key.

func (r *Relationship) Id() int
    Id gets the ID number of this Relationship

func (e *Relationship) Properties() (Properties, error)
    Properties fetches all properties

func (e *Relationship) SetProperties(p Properties) error
    SetProperties updates all properties, overwriting any existing
    properties.

func (e *Relationship) SetProperty(key string, value string) error
    SetProperty sets the single property key to value.

func (r *Relationship) Start() (*Node, error)
    Start gets the starting Node of this Relationship.

func (r *Relationship) Type() string
    Type gets the type of this relationship
@garyburd
Copy link
Contributor

Thank you for reporting this. Fixed.

@jmcvetta
Copy link
Contributor Author

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants