artisanalinteger

package module
Version: v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2019 License: BSD-3-Clause Imports: 3 Imported by: 9

README

go-artisanal-integers

No, really.

Install

You will need to have both Go and the make programs installed on your computer. Assuming you do just type:

make tools

All of this package's dependencies are bundled with the code in the vendor directory.

Usage

Interfaces

Client
type Client interface {
	NextInt() (int64, error)
}
Engine

An "engine" is the interface between your code and an underlying data model (typically a database) for minting artisanal integers. The interface looks like this:

type Engine interface {
	NextInt() (int64, error)
	LastInt() (int64, error)
	SetLastInt(int64) error
	SetKey(string) error
	SetOffset(int64) error
	SetIncrement(int64) error
	Close() error
}
Service
type Service interface {
	NextInt() (int64, error)
	LastInt() (int64, error)
}
Server
type Server interface {
	ListenAndServe(Service) error
}

Tools

Everything is in flux. This will be updated soon.

Engines

See also

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterClient added in v0.1.1

func RegisterClient(ctx context.Context, name string, cl Client) error

Types

type Client

type Client interface {
	NextInt() (int64, error)
}

func NewClient added in v0.1.1

func NewClient(ctx context.Context, uri string) (Client, error)

type Engine

type Engine interface {
	NextInt() (int64, error)
	LastInt() (int64, error)
	SetLastInt(int64) error
	SetKey(string) error
	SetOffset(int64) error
	SetIncrement(int64) error
	Close() error
}

type Integer

type Integer struct {
	Integer int64 `json:"integer"`
}

type Server

type Server interface {
	ListenAndServe(Service) error
	Address() string
}

type Service

type Service interface {
	NextInt() (int64, error)
	LastInt() (int64, error)
}

Source Files

Directories

Path Synopsis
cmd
int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL