object

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package object provides basic interfaces and default implementations of them. Provides reference interface and types of reference scope.

Usage:

package main

func main() {
	domain := "1"
	record := "1"
	ref, err := NewReference(domain, record, GlobalScope)
}

Index

Constants

View Source
const (
	ChildScope = ScopeType(iota + 1)
	ContextScope
	GlobalScope
)

ChildScope, ContextScope and GlobalScope represents types of scope for references.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseObject

type BaseObject struct {
}

BaseObject is a base implementation of Object interface.

func (*BaseObject) GetClassID

func (bo *BaseObject) GetClassID() string

GetClassID return string representation of object's class.

type Callable

type Callable interface {
	Object
}

Callable is a marker interface that shows that object is able to be called.

type Child

type Child interface {
	Callable
	GetParent() Parent
}

Child allows to be created inside object (smart contract).

type Object

type Object interface {
	GetClassID() string
}

Object marks that instance has ClassID (string representation of class).

type Parent

type Parent interface {
	Callable
	GetChildStorage() storage.Storage     // Storage for child references
	AddChild(child Child) (string, error) // return key for GetChild func
	GetChild(key string) (Child, error)   // child type reference
	GetContext() []string                 // Parent give information about context references to its children
	GetContextStorage() storage.Storage   // Storage for context references
}

Parent allows to create objects (smart contracts) inside itself as children.

type Reference

type Reference interface {
	String() string
	GetRecord() string
	GetDomain() string
	GetScope() ScopeType
}

Reference represents address of object.

func NewReference

func NewReference(domain string, record string, scope ScopeType) (Reference, error)

NewReference creates new reference instance.

type ScopeType

type ScopeType int

ScopeType represent type of scope for references.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL