Documentation ¶
Index ¶
- type Config
- type ListsDB
- type Repository
- func (r *Repository) CreateListNodeTable() error
- func (r *Repository) GetConnection()
- func (r *Repository) InsertLists(lists []*models.ListNode) (int64, error)
- func (r *Repository) SelectLists(id int64) ([]*models.ListNode, error)
- func (r *Repository) UpdateMergedList(mergedList models.ListNode, id int64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Host string Port string User string Password string DbName string SSLMode string Driver string StringConn string }
Config is a struct to hold the database configuration
type ListsDB ¶
type ListsDB struct { ID sql.NullInt64 `db:"id"` List1 sql.NullString `db:"list_1"` List2 sql.NullString `db:"list_2"` Merged sql.NullString `db:"merged"` }
ListsDB is a struct to use in the database to bear the models.ListNode
type Repository ¶
Repository is a struct to hold the database connection
func NewRepository ¶
func NewRepository(config Config) *Repository
NewRepository returns a new Repository
func (*Repository) CreateListNodeTable ¶
func (r *Repository) CreateListNodeTable() error
CreateListNodeTable is a function to create the list_node table in the database
func (*Repository) GetConnection ¶
func (r *Repository) GetConnection()
GetConnection returns a connection to the database
func (*Repository) InsertLists ¶
func (r *Repository) InsertLists(lists []*models.ListNode) (int64, error)
InsertLists is a function to insert a list into the database
func (*Repository) SelectLists ¶
func (r *Repository) SelectLists(id int64) ([]*models.ListNode, error)
SelectLists is a function to select all lists from the database based on the id
func (*Repository) UpdateMergedList ¶
func (r *Repository) UpdateMergedList(mergedList models.ListNode, id int64) error
UpdateMergedList is a function to update the merged list in the database
Click to show internal directories.
Click to hide internal directories.