memory

package
v0.0.0-...-b2f019a Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	ID   int
	Name string
}

User 戻り値の形式を定義。ドメインモデルのデータと同じだけど層をまたいで参照させないためにここでも定義している

type UserList

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

UserList ユーザ情報一覧構造体

func NewUserMemory

func NewUserMemory() UserList

NewUserMemory User情報をメモリに保存 [この関数をwireでDI]

func (UserList) Get

func (u UserList) Get(id int) (*User, error)

Get IDでユーザ情報を取得

func (UserList) GetAll

func (u UserList) GetAll() ([]*User, error)

GetAll ユーザ情報一覧を取得

func (*UserList) Store

func (u *UserList) Store(data User) (bool, error)

Store ユーザ情報を保存

type UserMemory

type UserMemory interface {
	Store(data User) (bool, error)
	Get(id int) (*User, error)
	GetAll() ([]*User, error)
}

UserMemory インターフェイス

Jump to

Keyboard shortcuts

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