Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Identifier ¶
func Identifier(d Data) identifier
Identifier returns an identifier unique to this Data, this is different from Data.Identifier in that the former is only unique to the provider associated with the Data. The identifier returned by Identifier is unique in the whole system.
func RegisterProvider ¶
func RegisterProvider(name string, provider DataProvider)
RegisterProvider registers a DataProvider with the given name.
A DataProvider can be registered under multiple names ¶
Note: changing the name of a data provider after any data has entered the system will result in data becoming unreachable. Therefore if you want to change the name of your data provider you should register a backwards-compatible version under the old name to be used with the existing data.
func StoreIdentifier ¶
StoreIdentifier stores the identifier, it should point to valid data. The sourceTime is the time this data was created at the data source (e.g news article posting date/time).
Types ¶
type Data ¶
type Data interface { // Type returns the type of data this is Type() DataType // Provider returns the DataProvider of this data Provider() DataProvider // Identifier is called to get an unique identifier to this // data. The identifier only has to be unique to the // DataProvider returned by Provider. Identifier() string // Render should write a html representation of the data to // the writer given. Render(w io.Writer) error }
Data is the interface used to support arbitrary kinds of data in plethora. All data types need to support the interface to be able to register with plethora.
type DataProvider ¶
DataProvider returns the Data associated with the identifier passed.