Documentation ¶
Index ¶
- type Board
- type BoardManager
- type BoardModel
- func (bm BoardModel) AddContributorToBoard(ctx context.Context, contrib Contributor, board Board) (Board, error)
- func (bm BoardModel) AddTagToBoard(ctx context.Context, tag Tag, board Board) (Board, error)
- func (bm BoardModel) AddTaskToBoard(ctx context.Context, task Task, board Board) (Board, error)
- func (bm BoardModel) Create(ctx context.Context, board Board) (Board, error)
- func (bm BoardModel) DeleteByID(ctx context.Context, boardID uint32) error
- func (bm BoardModel) GetByID(ctx context.Context, boardID uint32) (Board, error)
- func (bm BoardModel) RemoveContributorFromBoard(ctx context.Context, contrib Contributor, board Board) (Board, error)
- func (bm BoardModel) RemoveTagFromBoard(ctx context.Context, tag Tag, board Board) (Board, error)
- func (bm BoardModel) RemoveTaskFromBoard(ctx context.Context, task Task, board Board) (Board, error)
- type BoardOwner
- type Contributor
- type DB
- type DBConn
- type Person
- type PersonManager
- type PersonModel
- func (pm PersonModel) Create(ctx context.Context, person Person) (Person, error)
- func (pm PersonModel) DeleteByID(ctx context.Context, personID uint32) error
- func (pm PersonModel) GetByEmail(ctx context.Context, email string) (Person, error)
- func (pm PersonModel) GetByID(ctx context.Context, personID uint32) (Person, error)
- func (pm PersonModel) GetByUsername(ctx context.Context, username string) (Person, error)
- type SmallBoard
- type SmallPerson
- type Subtask
- type SystemManager
- type SystemModel
- type Tag
- type TagManager
- type TagModel
- type Task
- type TaskAssignee
- type TaskAuthor
- type TaskManager
- type TaskModel
- func (tm TaskModel) AddAssigneeToTask(ctx context.Context, assignee TaskAssignee, task Task) (Task, error)
- func (tm TaskModel) AddSubtaskToTask(ctx context.Context, subtask Subtask, task Task) (Task, error)
- func (tm TaskModel) AddTagToTask(ctx context.Context, tag Tag, task Task) (Task, error)
- func (tm TaskModel) Create(ctx context.Context, t Task) (Task, error)
- func (tm TaskModel) DeleteByID(ctx context.Context, taskID uint32) error
- func (tm TaskModel) GetByID(ctx context.Context, taskID uint32) (Task, error)
- func (tm TaskModel) RemoveAssignFromTask(ctx context.Context, assignee TaskAssignee, task Task) (Task, error)
- func (tm TaskModel) RemoveSubtaskFromTask(ctx context.Context, subtask Subtask, task Task) (Task, error)
- func (tm TaskModel) RemoveTagFromTask(ctx context.Context, tag Tag, task Task) (Task, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Board ¶
type Board struct { Owner BoardOwner `json:"owner"` Name string `json:"board_name"` Contributors []Contributor // LoadBoardContributors() by person_id from contributor table Tasks []Task Tags []Tag ID uint32 `json:"board_id"` }
Board - board model struct.
func (Board) Small ¶
func (b Board) Small() SmallBoard
Small - return SmallBoard representation of Person.
type BoardManager ¶
type BoardManager interface { Create(ctx context.Context, board Board) (Board, error) DeleteByID(ctx context.Context, boardID uint32) error GetByID(ctx context.Context, boardID uint32) (Board, error) AddContributorToBoard(ctx context.Context, contrib Contributor, board Board) (Board, error) RemoveContributorFromBoard(ctx context.Context, contrib Contributor, board Board) (Board, error) AddTaskToBoard(ctx context.Context, task Task, board Board) (Board, error) RemoveTaskFromBoard(ctx context.Context, task Task, board Board) (Board, error) AddTagToBoard(ctx context.Context, tag Tag, board Board) (Board, error) RemoveTagFromBoard(ctx context.Context, tag Tag, board Board) (Board, error) }
BoardManager - interface for interacting with board table in db.
type BoardModel ¶
type BoardModel struct {
DB DBConn
}
BoardModel - struct that implements BoardManager interface for interacting with board table in db.
func (BoardModel) AddContributorToBoard ¶
func (bm BoardModel) AddContributorToBoard(ctx context.Context, contrib Contributor, board Board) (Board, error)
AddContributorToBoard - adds row in contributor table with values (person.ID, board.ID).
func (BoardModel) AddTagToBoard ¶
AddTagToBoard - add tag to table 'tag' in db with board_id = board.ID.
func (BoardModel) AddTaskToBoard ¶
AddTaskToBoard - add task to table 'task' in db with board_id = board.ID.
func (BoardModel) DeleteByID ¶
func (bm BoardModel) DeleteByID(ctx context.Context, boardID uint32) error
DeleteByID - deletes row from table 'board'.
func (BoardModel) RemoveContributorFromBoard ¶
func (bm BoardModel) RemoveContributorFromBoard(ctx context.Context, contrib Contributor, board Board) (Board, error)
RemoveContributorFromBoard - removes row in contributor table with values (person.ID, board.ID).
func (BoardModel) RemoveTagFromBoard ¶
RemoveTagFromBoard - removes task from board.
func (BoardModel) RemoveTaskFromBoard ¶
func (bm BoardModel) RemoveTaskFromBoard(ctx context.Context, task Task, board Board) (Board, error)
RemoveTaskFromBoard - removes task from board.
type BoardOwner ¶
type BoardOwner SmallPerson
BoardOwner - other name for SmallPerson struct, used for representing board owner in Board struct.
type Contributor ¶
Contributor - struct that used to represent contributors(persons) in Board.Contributors field.
type DB ¶
type DB struct { System SystemManager Person PersonManager Board BoardManager Task TaskManager Tag TagManager }
DB - struct for interacting with database.
type DBConn ¶
type DBConn interface { Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error) QueryRow(ctx context.Context, sql string, args ...any) pgx.Row Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error) }
DBConn - interface for data models to interact with db.
type Person ¶
type Person struct { Username string `json:"username"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Email string `json:"email"` PasswordHash string `json:"password_hash"` Boards []SmallBoard // LoadPersonBoards(), by board_id from contributor table AssignedTasks []Task // LoadPersonAssignedTasks(), from executor_id in task ID uint32 `json:"person_id"` }
Person - person model struct.
func (*Person) IsContributor ¶
func (p *Person) IsContributor(contrib Contributor) bool
IsContributor - checks if p of type Person represent same row from db as contrib of type Contributor.
func (Person) Small ¶
func (p Person) Small() SmallPerson
Small - return SmallPerson representation of Person.
type PersonManager ¶
type PersonManager interface { Create(ctx context.Context, person Person) (Person, error) DeleteByID(ctx context.Context, personID uint32) error GetByID(ctx context.Context, personID uint32) (Person, error) GetByEmail(ctx context.Context, email string) (Person, error) GetByUsername(ctx context.Context, username string) (Person, error) }
PersonManager - interface for interacting with person table in db.
type PersonModel ¶
type PersonModel struct {
DB DBConn
}
PersonModel - struct that implements PersonManager interface for interacting with person table in db.
func (PersonModel) DeleteByID ¶
func (pm PersonModel) DeleteByID(ctx context.Context, personID uint32) error
DeleteByID - deletes row from table 'person'.
func (PersonModel) GetByEmail ¶
GetByEmail - searching for person in DB by email, returning finded Person.
func (PersonModel) GetByUsername ¶
GetByUsername - searching for person in DB by username, returning finded Person.
type SmallBoard ¶
type SmallBoard struct { Name string Owner BoardOwner ID uint32 }
SmallBoard - is a struct, that used to save board data in some other structs, when we don't need to save all board information like contributors, tasks, tags.
type SmallPerson ¶
type SmallPerson struct { Username string `json:"username"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Email string `json:"email"` ID uint32 `json:"person_id"` }
SmallPerson - is a struct, that used to save person data in some other structs, when we don't need to save all person information like password, board, assigned tasks and other.
type Subtask ¶
type Subtask struct { Name string `json:"subtask_name"` ID uint32 `json:"subtask_id"` ParentTaskID uint32 `json:"parent_task_id"` }
Subtask - subtask model struct.
type SystemManager ¶
type SystemManager interface { RecreateAllTables(ctx context.Context) error IsTableExist(ctx context.Context, tableName string) (bool, error) }
SystemManager - interface for interacting with db structure.
type SystemModel ¶
type SystemModel struct {
DB DBConn
}
SystemModel - struct that implements SystemManager interface for interacting with database structure.
func (SystemModel) IsTableExist ¶
IsTableExist - returning `true` if table exist in 'public' scheme, else `false`.
func (SystemModel) RecreateAllTables ¶
func (sm SystemModel) RecreateAllTables(ctx context.Context) error
RecreateAllTables - drops previously created table and creates tables required by the GoKan.
type Tag ¶
type Tag struct { Name string `json:"tag_name"` Description string `json:"tag_description"` ID uint32 `json:"tag_id"` BoardID uint32 `json:"board_id"` }
Tag - tag model struct.
type TagManager ¶
type TagManager interface { Create(ctx context.Context, tag Tag) (Tag, error) DeleteByID(ctx context.Context, tagID uint32) error GetByID(ctx context.Context, tagID uint32) (Tag, error) }
TagManager - interface for interacting with tag table in db.
type TagModel ¶
type TagModel struct {
DB DBConn
}
TagModel - struct that implements TagManager interface for interacting with tag table in db.
func (TagModel) Create ¶
Create - Creates new row in table 'tag'. Returning created Person.
Don't use directly, to create new tag use BoardModel.AddTagToBoard.
func (TagModel) DeleteByID ¶
DeleteByID - deletes row from table 'tag'.
type Task ¶
type Task struct { Assignees []TaskAssignee Author TaskAuthor `json:"author"` Name string `json:"task_name"` Description string `json:"task_description"` Subtasks []Subtask Tags []Tag ID uint32 `json:"task_id"` BoardID uint32 `json:"board_id"` }
Task - task model struct.
type TaskAssignee ¶
type TaskAssignee SmallPerson
TaskAssignee - other name for SmallPerson struct, used for representing task executor in Task struct.
type TaskAuthor ¶
type TaskAuthor SmallPerson
TaskAuthor - other name for SmallPerson struct, used for representing task author in Task struct.
type TaskManager ¶
type TaskManager interface { Create(ctx context.Context, task Task) (Task, error) DeleteByID(ctx context.Context, taskID uint32) error GetByID(ctx context.Context, taskID uint32) (Task, error) AddTagToTask(ctx context.Context, tag Tag, task Task) (Task, error) RemoveTagFromTask(ctx context.Context, tag Tag, task Task) (Task, error) AddAssigneeToTask(ctx context.Context, assignee TaskAssignee, task Task) (Task, error) RemoveAssignFromTask(ctx context.Context, person TaskAssignee, task Task) (Task, error) AddSubtaskToTask(ctx context.Context, subtask Subtask, task Task) (Task, error) RemoveSubtaskFromTask(ctx context.Context, subtask Subtask, task Task) (Task, error) }
TaskManager - interface for interacting with task table in db.
type TaskModel ¶
type TaskModel struct {
DB DBConn
}
TaskModel - struct that implements TaskManager interface for interacting with task table in db.
func (TaskModel) AddAssigneeToTask ¶
func (tm TaskModel) AddAssigneeToTask(ctx context.Context, assignee TaskAssignee, task Task) (Task, error)
AddAssigneeToTask - assigning task to person in assignee table.
func (TaskModel) AddSubtaskToTask ¶
AddSubtaskToTask - add subtask to task in subtask table.
func (TaskModel) AddTagToTask ¶
AddTagToTask - add tag to task in task_tag table.
func (TaskModel) Create ¶
Create - Creates new row in table 'task' with values from `t` fields, Returning created Task.
Don't use directly, to create new task use BoardModel.AddTaskToBoard.
func (TaskModel) DeleteByID ¶
DeleteByID - deletes row from table 'task'.
func (TaskModel) RemoveAssignFromTask ¶
func (tm TaskModel) RemoveAssignFromTask(ctx context.Context, assignee TaskAssignee, task Task) (Task, error)
RemoveAssignFromTask - removes row from assignee table;.