Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make IObject really public by exporting objectInterface #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import (
// Each auto-generated type implements the IObject interface.
type TypeMap map[string]reflect.Type

// objectInterface defines the interface used internally between
// ObjectInterface defines the interface used internally between
// ObjectBase and Client implmementation
type objectInterface interface {
type ObjectInterface interface {
GetField(IObject, string) error
UpdateReference(*ReferenceUpdateMsg) error
}
Expand Down Expand Up @@ -107,7 +107,11 @@ func (c *Client) SetAuthenticator(auth Authenticator) {
}

func typename(ptr IObject) string {
name := reflect.TypeOf(ptr).Elem().Name()
tname := reflect.TypeOf(ptr)
if tname.Kind() == reflect.Ptr {
tname = tname.Elem()
}
name := tname.Name()
var buf []rune
for i, c := range name {
if unicode.IsUpper(c) {
Expand Down
6 changes: 3 additions & 3 deletions object.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type IObject interface {
SetUuid(string)
SetFQName(string, []string)

SetClient(objectInterface)
SetClient(ObjectInterface)
UpdateObject() ([]byte, error)
UpdateReferences() error
UpdateDone()
Expand All @@ -45,7 +45,7 @@ type ObjectBase struct {

// clientPtr is set once the object is persisted in the API server
// or for objects that are retrieved via Read/GET
clientPtr objectInterface
clientPtr ObjectInterface
parent IObject
}

Expand Down Expand Up @@ -123,7 +123,7 @@ func (obj *ObjectBase) GetParentType() string {

// SetClient is used to mark an object as persistent (it has been created or read)
// from the API and supplying it with the methods required to perform an update.
func (obj *ObjectBase) SetClient(c objectInterface) {
func (obj *ObjectBase) SetClient(c ObjectInterface) {
obj.clientPtr = c
}

Expand Down