realm

package
v0.0.0-...-7d41a23 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package realm contains all code related to the realm domain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

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

Driver is the entry point of the domain that expose methods.

func NewDriver

func NewDriver(storage Storage) Driver

NewDriver create a new domain driver with given driven implementations.

func (Driver) Delete

func (d Driver) Delete(id string) error

Delete the realm with id.

func (Driver) Get

func (d Driver) Get(id string) (Realm, error)

Get the realm with id.

func (Driver) List

func (d Driver) List() (List, error)

List all realms.

func (Driver) Set

func (d Driver) Set(id string, url string, username string) error

Set method create (if not exists) or update (if exists) the realm with id.

type List

type List interface {
	All() []Realm
	Index(idx uint) Realm
	Len() uint
	String() string
	MarshalJSON() ([]byte, error)
	MarshalYAML() (interface{}, error)
}

List of realm objects.

func NewList

func NewList(slice []Realm) List

NewList create a new list of realms object.

type Realm

type Realm interface {
	ID() string
	URL() string
	Username() string
	String() string
	MarshalJSON() ([]byte, error)
	MarshalYAML() (interface{}, error)
}

Realm object contains informations about a realm.

func NewRealm

func NewRealm(id, url, username string) Realm

NewRealm create a new realm object.

type Storage

type Storage interface {
	CreateOrUpdateRealm(r Realm) error
	GetRealm(id string) (Realm, error)
	ListRealms() (List, error)
	DeleteRealm(id string) error
}

Storage interface for storing realms.

Jump to

Keyboard shortcuts

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