branchstore

package
v0.0.0-...-70edb27 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package branchstore contains the CRUD operations for the branch on the database

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIDMissing will be thrown if an ID is expected but not set
	ErrIDMissing = errors.New("id is mandatory for this operation")

	// ErrIDIsSet will be thrown if no ID is expected but already set
	ErrIDIsSet = errors.New("id should be not set for this operation, use update instead")

	// ErrDataMissing will be thrown if mandatory data is not set
	ErrDataMissing = errors.New("no data or mandatory data missing")
)

Functions

This section is empty.

Types

type Branch

type Branch struct {
	ID             int       `db:"id"`
	Name           string    `db:"branch_name"`
	TicketID       string    `db:"ticket_id"`
	ParentTicketID string    `db:"parent_ticket_id"`
	RepositoryID   int       `db:"repository_id"`
	TicketSummary  string    `db:"ticket_summary"`
	TicketStatus   string    `db:"ticket_status"`
	TicketType     string    `db:"ticket_type"`
	Closed         bool      `db:"closed"`
	CreatedAt      time.Time `db:"created_at"`
	ModifiedAt     time.Time `db:"modified_at"`
}

Branch represents the branch in the database

func (*Branch) Create

func (b *Branch) Create(ctx context.Context, db *sqlx.DB) error

Create creates current branch in the database

func (*Branch) Delete

func (b *Branch) Delete(ctx context.Context, db *sqlx.DB) error

Delete removes the current branch from database by its ID

func (*Branch) IsValid

func (b *Branch) IsValid() bool

IsValid returns true if all mandatory fields are set

func (*Branch) Read

func (b *Branch) Read(ctx context.Context, db *sqlx.DB) error

Read sets the branch from database by given ID

func (*Branch) Update

func (b *Branch) Update(ctx context.Context, db *sqlx.DB) error

Update changes the current branch on the database by ID

Jump to

Keyboard shortcuts

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