rdb

package
v0.0.0-...-3c201f0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Board

type Board struct {
	ID        string `gorm:"primary_key"`
	UserID    string `gorm:"primary_key"`
	Title     string
	Text      *string
	Color     string
	Before    *string
	After     *string
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
}

Board is Board data model for DB.

type BoardDBManager

type BoardDBManager struct{}

BoardDBManager is DB manager for Board.

func (*BoardDBManager) Create

func (*BoardDBManager) Create(tx usecase.Transaction, board model.Board) error

Create registers a Board to DB.

func (*BoardDBManager) Delete

func (*BoardDBManager) Delete(tx usecase.Transaction, board model.Board) error

Delete removes a Board from DB.

func (*BoardDBManager) Find

func (*BoardDBManager) Find(tx usecase.Transaction, conditions map[string]interface{}) (model.Boards, error)

Find gets Boards.

func (*BoardDBManager) FindByID

func (*BoardDBManager) FindByID(tx usecase.Transaction, id, userID string) (model.Board, error)

FindByID gets a Board had specific ID from DB.

func (*BoardDBManager) Update

func (*BoardDBManager) Update(tx usecase.Transaction, board model.Board, updates map[string]interface{}) error

Update updates all fields of specific Board in DB.

type Boards

type Boards []Board

Boards is a slice of Board data model.

type DBManager

type DBManager struct {
	TransactionManager TransactionManager
	ItemDBManager      ItemDBManager
	ListDBManager      ListDBManager
	BoardDBManager     BoardDBManager
	UserDBManager      UserDBManager
	TagDBManager       TagDBManager
}

DBManager includes DB managers for all data model.

func NewDBManager

func NewDBManager() (DBManager, error)

NewDBManager generates new DB manager.

type Item

type Item struct {
	ID        string `gorm:"primary_key"`
	UserID    string `gorm:"primary_key"`
	ListID    string
	Title     string
	Text      *string
	Tags      *string
	Before    *string
	After     *string
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
}

Item is Item data model for DB.

type ItemDBManager

type ItemDBManager struct{}

ItemDBManager is DB manager for Item.

func (*ItemDBManager) Create

func (*ItemDBManager) Create(tx usecase.Transaction, item model.Item) error

Create registers a Item to DB.

func (*ItemDBManager) Delete

func (*ItemDBManager) Delete(tx usecase.Transaction, item model.Item) error

Delete removes a Item from DB.

func (*ItemDBManager) Find

func (*ItemDBManager) Find(tx usecase.Transaction, conditions map[string]interface{}) (model.Items, error)

Find gets Items.

func (*ItemDBManager) FindByID

func (*ItemDBManager) FindByID(tx usecase.Transaction, id, userID string) (model.Item, error)

FindByID gets a Item had specific ID from DB.

func (*ItemDBManager) Update

func (*ItemDBManager) Update(tx usecase.Transaction, item model.Item, updates map[string]interface{}) error

Update updates all fields of specific Item in DB.

type Items

type Items []Item

Items is a slice of Item data model.

type List

type List struct {
	ID        string `gorm:"primary_key"`
	UserID    string `gorm:"primary_key"`
	BoardID   string
	Title     string
	Before    *string
	After     *string
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
}

List is List data model for DB.

type ListDBManager

type ListDBManager struct{}

ListDBManager is DB manager for List.

func (*ListDBManager) Create

func (*ListDBManager) Create(tx usecase.Transaction, list model.List) error

Create registers a List to DB.

func (*ListDBManager) Delete

func (*ListDBManager) Delete(tx usecase.Transaction, list model.List) error

Delete removes a List from DB.

func (*ListDBManager) Find

func (*ListDBManager) Find(tx usecase.Transaction, conditions map[string]interface{}) (model.Lists, error)

Find gets Lists.

func (*ListDBManager) FindByID

func (*ListDBManager) FindByID(tx usecase.Transaction, id, userID string) (model.List, error)

FindByID gets a List had specific ID from DB.

func (*ListDBManager) Update

func (*ListDBManager) Update(tx usecase.Transaction, list model.List, updates map[string]interface{}) error

Update updates all fields of specific List in DB.

type Lists

type Lists []List

Lists is a slice of List data model.

type Tag

type Tag struct {
	ID        string `gorm:"primary_key"`
	Name      string
	Color     string
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
}

Tag is Tag data model for DB.

type TagDBManager

type TagDBManager struct{}

TagDBManager is DB manager for Tag.

func (*TagDBManager) Create

func (*TagDBManager) Create(tx usecase.Transaction, tag model.Tag) error

Create registers a Tag to DB.

func (*TagDBManager) Find

func (*TagDBManager) Find(tx usecase.Transaction, conditions map[string]interface{}) (model.Tags, error)

Find get Tags.

type Tags

type Tags []Tag

Tags is a slice of Tag data model.

type Transaction

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

func (*Transaction) Commit

func (tx *Transaction) Commit()

func (*Transaction) DB

func (tx *Transaction) DB() interface{}

func (*Transaction) Rollback

func (tx *Transaction) Rollback()

type TransactionManager

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

TransactionManager is DB transaction manager.

func (*TransactionManager) BeginTransaction

func (m *TransactionManager) BeginTransaction(on bool) usecase.Transaction

type User

type User struct {
	ID   string `gorm:"primary_key"`
	Name string
	// Password is raw. It should be hash.
	Password  string
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
}

User is User data model for DB.

type UserDBManager

type UserDBManager struct{}

UserDBManager is DB manager for User.

func (*UserDBManager) Create

func (*UserDBManager) Create(tx usecase.Transaction, user model.User) error

Create registers a User to DB.

func (*UserDBManager) Find

func (*UserDBManager) Find(tx usecase.Transaction, conditions map[string]interface{}) (model.User, error)

Find gets a User.

type Users

type Users []User

Users is a slice of User data model.

Jump to

Keyboard shortcuts

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