model

package
v3.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package model is an interface for data modelling

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeleteOption

type DeleteOption func(o *DeleteOptions)

type DeleteOptions

type DeleteOptions struct{}

type Entity

type Entity interface {
	// Unique id of the entity
	Id() string
	// Name of the entity
	Name() string
	// The value associated with the entity
	Value() interface{}
	// Attributes of the entity
	Attributes() map[string]interface{}
}

type Model

type Model interface {
	// Initialise options
	Init(...Option) error
	// NewEntity creates a new entity to store or access
	NewEntity(name string, value interface{}) Entity
	// Create a value
	Create(Entity) error
	// Read values
	Read(...ReadOption) ([]Entity, error)
	// Update the value
	Update(Entity) error
	// Delete an entity
	Delete(...DeleteOption) error
	// Implementation of the model
	String() string
}

Model provides an interface for data modelling

type Option

type Option func(o *Options)

type Options

type Options struct {
	// Database to write to
	Database string
	// for serialising
	Codec codec.Marshaler
	// for locking
	Sync sync.Sync
	// for storage
	Store store.Store
}

type ReadOption

type ReadOption func(o *ReadOptions)

type ReadOptions

type ReadOptions struct{}

Directories

Path Synopsis
Package mud is the micro data model implementation
Package mud is the micro data model implementation
Package sql is the micro data model implementation
Package sql is the micro data model implementation

Jump to

Keyboard shortcuts

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