mysql

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const IssuesTable = "issues"
View Source
const SettingsTable = "settings"
View Source
const SprintIssuesTable = "sprint_issues"

Variables

This section is empty.

Functions

This section is empty.

Types

type Issue

type Issue struct {
	ID          int64  `json:"id" gorm:"primaryKey"`
	TlgrmChatID int64  `json:"tlgrm_chat_id"`
	CreatedAt   string `json:"created_at"`
	Date        string `json:"date"`
	Done        bool   `json:"done"`
	Text        string `json:"text"`
}

Issue contains issue data

func (Issue) TableName

func (Issue) TableName() string

type IssueCreateData

type IssueCreateData struct {
	TlgrmChatID int64  `json:"tlgrm_chat_id"`
	CreatedAt   string `json:"created_at"`
	Date        string `json:"date"`
	Done        bool   `json:"done"`
	Text        string `json:"text"`
}

IssueCreateData contains data to create new issue

func (IssueCreateData) TableName

func (IssueCreateData) TableName() string

type IssueUpdateData

type IssueUpdateData struct {
	ID          int64   `json:"id" gorm:"->"`
	TlgrmChatID int64   `json:"tlgrm_chat_id" gorm:"->"`
	CreatedAt   *string `json:"created_at"`
	Date        *string `json:"date"`
	Done        *bool   `json:"done"`
	Text        *string `json:"text"`
}

IssueUpdateData contains data to update issue

func (IssueUpdateData) TableName

func (IssueUpdateData) TableName() string

type MySQL

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

MySQL it is a MySQL module context structure

func Connect

func Connect(p Param) (MySQL, error)

Connect connects to MySQL

func (*MySQL) Close

func (m *MySQL) Close() error

Close closes MySQL connection

func (*MySQL) IssueCreate

func (m *MySQL) IssueCreate(issue IssueCreateData) (Issue, error)

IssueCreate creates new issue

func (*MySQL) IssueDel

func (m *MySQL) IssueDel(id, tID int64) error

IssueDel deletes specified issue

func (*MySQL) IssueGetByID

func (m *MySQL) IssueGetByID(id, tID int64) (Issue, error)

IssueGetByID gets issue by specified ID and user

func (*MySQL) IssueUpdate

func (m *MySQL) IssueUpdate(issue IssueUpdateData) (Issue, error)

IssueUpdate updates issue by specified ID and user

func (*MySQL) IssuesGetByDate

func (m *MySQL) IssuesGetByDate(tID int64, date string) ([]Issue, error)

IssuesGetByDate gets all issues for specified user and date

func (*MySQL) SettingsGet

func (m *MySQL) SettingsGet(tID int64) (Settings, error)

SettingsGet gets settings for specified user

func (*MySQL) SettingsSet

func (m *MySQL) SettingsSet(s SettingsSetData) (Settings, error)

SettingsSet adds new settings record into DB or update if exist

func (*MySQL) SprintIssueCreate

func (m *MySQL) SprintIssueCreate(si SprintIssueCreateData) (SprintIssue, error)

SprintIssueCreate creates new sprint issue

func (*MySQL) SprintIssueDel

func (m *MySQL) SprintIssueDel(id, tID int64) error

SprintIssueDel deletes specified sprint issue

func (*MySQL) SprintIssueGetByID

func (m *MySQL) SprintIssueGetByID(id, tID int64) (SprintIssue, error)

SprintIssueGetByID gets sprint issue by specified ID and user

func (*MySQL) SprintIssueUpdate

func (m *MySQL) SprintIssueUpdate(si SprintIssueUpdateData) (SprintIssue, error)

IssueUpdate updates issue by specified ID and user

func (*MySQL) SprintIssuesGetByDate

func (m *MySQL) SprintIssuesGetByDate(tID int64, date string) ([]SprintIssue, error)

SprintIssuesGetByDate gets all sprint issues for specified user and date

type Param

type Param struct {
	Host     string
	User     string
	Password string
	Database string
}

Settings contains settings for MySQL

type Settings

type Settings struct {
	TlgrmChatID int64  `json:"tlgrm_chat_id" gorm:"primaryKey"`
	CurrentDate string `json:"current_date"`
}

func (Settings) TableName

func (Settings) TableName() string

type SettingsSetData

type SettingsSetData struct {
	TlgrmChatID int64  `json:"tlgrm_chat_id" gorm:"primaryKey"`
	CurrentDate string `json:"current_date"`
}

func (SettingsSetData) TableName

func (SettingsSetData) TableName() string

type SprintIssue

type SprintIssue struct {
	ID          int64  `json:"id" gorm:"primaryKey"`
	TlgrmChatID int64  `json:"tlgrm_chat_id"`
	Date        string `json:"date"`
	Goal        bool   `json:"goal"`
	Done        bool   `json:"done"`
	Text        string `json:"text"`
}

Issue contains sprint issue data

func (SprintIssue) TableName

func (SprintIssue) TableName() string

type SprintIssueCreateData

type SprintIssueCreateData struct {
	TlgrmChatID int64  `json:"tlgrm_chat_id"`
	Date        string `json:"date"`
	Goal        bool   `json:"goal"`
	Done        bool   `json:"done"`
	Text        string `json:"text"`
}

IssueCreateData contains data to create new sprint issue

func (SprintIssueCreateData) TableName

func (SprintIssueCreateData) TableName() string

type SprintIssueUpdateData

type SprintIssueUpdateData struct {
	ID          int64   `json:"id" gorm:"->"`
	TlgrmChatID int64   `json:"tlgrm_chat_id" gorm:"->"`
	Date        *string `json:"date"`
	Goal        *bool   `json:"goal"`
	Done        *bool   `json:"done"`
	Text        *string `json:"text"`
}

SprintIssueUpdateData contains data to update sprint issue

func (SprintIssueUpdateData) TableName

func (SprintIssueUpdateData) TableName() string

Jump to

Keyboard shortcuts

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