database

package
v0.0.0-...-381577c Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Code generated by squick at 2021-07-20T23:05:41+03:00.

Code generated by squick at 2021-07-21T14:56:47+03:00. squick make -table ideas insert get:id select:used,deleted set:used,deleted

Code generated by squick at 2021-07-21T14:56:47+03:00. squick make -table voters insert delete select:vote_id

Code generated by squick at 2021-07-21T14:56:47+03:00. squick make -table votes insert get:done set:updated_at,message_id,days_left,done

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*sqlx.DB
}

func Open

func Open(url string) (*DB, error)

func (*DB) DeleteVoter

func (db *DB) DeleteVoter(userID int64) error

func (*DB) IdeaByID

func (db *DB) IdeaByID(id int) (idea Idea, _ error)

func (*DB) IdeasByDeleted

func (db *DB) IdeasByDeleted(deleted bool) ([]Idea, error)

func (*DB) IdeasByUsed

func (db *DB) IdeasByUsed(used bool) ([]Idea, error)

func (*DB) InsertIdea

func (db *DB) InsertIdea(idea Idea) (id int, _ error)

func (*DB) InsertVote

func (db *DB) InsertVote(vote Vote) (id int, _ error)

func (*DB) InsertVoter

func (db *DB) InsertVoter(voter Voter) (userID int64, _ error)

func (*DB) LastVote

func (db *DB) LastVote() (vote Vote, _ error)

func (*DB) VoteByDone

func (db *DB) VoteByDone(done bool) (vote Vote, _ error)

func (*DB) Voter

func (db *DB) Voter(voteID int, userID int64) (voter Voter, _ error)

func (*DB) VotersByVoteID

func (db *DB) VotersByVoteID(voteID int) ([]Voter, error)

type Force

type Force bool
const F Force = true

type Idea

type Idea struct {
	ID          int    `db:"id" json:"id"`
	Title       string `db:"title" json:"title"`
	Description string `db:"description" json:"description"`
	Emoji       string `db:"emoji" json:"emoji"`
	Used        bool   `db:"used" json:"used"`
	Deleted     bool   `db:"deleted" json:"deleted"`
	// contains filtered or unexported fields
}

func (*Idea) SetDeleted

func (idea *Idea) SetDeleted(deleted bool) error

func (*Idea) SetUsed

func (idea *Idea) SetUsed(used bool) error

type Vote

type Vote struct {
	CreatedAt time.Time     `db:"created_at" json:"createdAt"`
	UpdatedAt time.Time     `db:"updated_at" json:"updatedAt"`
	ID        int           `db:"id" json:"id"`
	Done      bool          `db:"done" json:"done"`
	DaysLeft  int           `db:"days_left" json:"daysLeft"`
	Ideas     pq.Int32Array `db:"ideas" json:"ideas"`
	MessageID string        `db:"message_id" json:"messageID"`
	// contains filtered or unexported fields
}

func (*Vote) SetDaysLeft

func (vote *Vote) SetDaysLeft(daysLeft int) error

func (*Vote) SetDone

func (vote *Vote) SetDone(done bool) error

func (*Vote) SetMessageID

func (vote *Vote) SetMessageID(messageID string) error

func (*Vote) SetUpdatedAt

func (vote *Vote) SetUpdatedAt(updatedAt time.Time) error

type Voter

type Voter struct {
	CreatedAt time.Time `db:"created_at" json:"createdAt"`
	UserID    int64     `db:"user_id" json:"userID"`
	VoteID    int       `db:"vote_id" json:"voteID"`
	IdeaID    int       `db:"idea_id" json:"ideaID"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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