data

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataBinder

type DataBinder interface {
	// A DataBinder must be a control so that we can serialize it
	ID() string
	// BindData is called by the data manager to get the data for the control during draw time
	BindData(ctx context.Context, s DataManagerI)
}

type DataManager

type DataManager struct {
	// contains filtered or unexported fields
}

DataManager is an object designed to be embedded in a control that will help manage the data binding process.

func (*DataManager) HasData added in v0.2.0

func (d *DataManager) HasData() bool

func (*DataManager) HasDataProvider

func (d *DataManager) HasDataProvider() bool

func (*DataManager) LoadData added in v0.2.0

func (d *DataManager) LoadData(ctx context.Context, owner DataManagerI)

LoadData tells the data binder to load data by calling SetData on the given object. The object should be the embedder of the DataManager

func (*DataManager) RangeData

func (d *DataManager) RangeData(f func(int, interface{}) bool)

RangeData will call the given function for each item in the data. The function should return true to continue, and false to end early.

func (*DataManager) ResetData

func (d *DataManager) ResetData()

ResetData is called by controls that use a data binder to unload the data after it is used.

func (*DataManager) SetData

func (d *DataManager) SetData(data interface{})

Call SetData to set the data of a control that uses a data binder. You MUST call it with a slice of some kind of data.

func (*DataManager) SetDataProvider

func (d *DataManager) SetDataProvider(b DataBinder)

type DataManagerEmbedder added in v0.2.0

type DataManagerEmbedder interface {
	SetDataProvider(b DataBinder)
	// SetData should be passed a slice of data items
	SetData(interface{})
	LoadData(ctx context.Context, owner DataManagerI)
	ResetData()
}

DataManagerEmbedder is the interface to include in embedded control interfaces Currently go does not allow interface conflicts, but that is scheduled to change

type DataManagerI

type DataManagerI interface {
	page.ControlI
	DataManagerEmbedder
}

A DataManagerI is the interface for the owner (the embedder) of the DataManager

Jump to

Keyboard shortcuts

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