dom

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 29, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package dom contains common domain (business-logic) entities.

Index

Constants

This section is empty.

Variables

View Source
var (
	NoName Name
	NoUser UserName
)

Empty values.

View Source
var (
	ErrInvalidName = errors.New("invalid name")
)

Errors.

Functions

func NewID added in v0.3.0

func NewID() string

NewID returns cryptographically secure unique ID with 16 to 63 [a-z0-9] characters and at least 64 bit entropy.

Types

type Auth

type Auth struct {
	UserName UserName
	Admin    bool
}

Auth should contain all authentication and authorization info needed to execute any operation on behalf of some user.

type Name added in v0.3.0

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

Name is an identifier of some entity in format "{collection}/{id}".

func NewName added in v0.3.0

func NewName(collection, id string) Name

NewName creates and returns Name with given collection and id.

func ParseName added in v0.3.0

func ParseName(collection, name string) (*Name, error)

ParseName returns ErrInvalidName if name doesn't belong to collection.

func (Name) ID added in v0.3.0

func (name Name) ID() string

ID returns "{id}" part of the name.

func (Name) String added in v0.3.0

func (name Name) String() string

String returns "{collection}/{id}" or empty string for NoName.

type UserName added in v0.3.0

type UserName struct{ Name }

UserName is a Name within "users" collection.

func NewUserName added in v0.3.0

func NewUserName(userID string) UserName

NewUserName converts user's ID to UserName.

func ParseUserName added in v0.3.0

func ParseUserName(name string) (*UserName, error)

ParseUserName returns ErrInvalidName if name doesn't belong to "users" collection.

Jump to

Keyboard shortcuts

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