models

package
v0.0.0-...-ebf00f0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseDbService

type BaseDbService interface {
}

type BaseModel

type BaseModel interface {
	// contains filtered or unexported methods
}

type CatalogItem

type CatalogItem struct {
	Id                int       `json:"id"`
	Title             string    `json:"title"`
	Description       string    `json:"description"`
	Url               string    `json:"url"`
	ImageFullUrl      string    `json:"image_full_url"`
	ImageThumbnailUrl string    `json:"image_thumbnail_url"`
	Published         bool      `json:"published"`
	PublishedAt       time.Time `json:"published_at"`
	CreatedAt         time.Time `json:"created"`
	UpdatedAt         time.Time `json:"updated"`
}

func (*CatalogItem) CreateOne

func (catalogItem *CatalogItem) CreateOne(db *sql.DB, data CatalogItemCreateParams) (*CatalogItem, error)

func (*CatalogItem) GetAll

func (catalogItem *CatalogItem) GetAll(db *sql.DB) ([]CatalogItem, error)

type CatalogItemCreateParams

type CatalogItemCreateParams struct {
	Title             string
	Description       string
	Url               string
	ImageFullUrl      string
	ImageThumbnailUrl string
	PublishedAt       time.Time `json:"published_at"`
}

type CreateParams

type CreateParams struct{}

Use for Updating a db object

type DeleteParams

type DeleteParams struct{}

use for deleting

type Query

type Query struct{}

Use for querying a table

type Table

type Table struct {
	Name     string
	Columns  TableColumns
	PkColumn string
}

func (*Table) BuildCreateStatment

func (t *Table) BuildCreateStatment(db *sql.DB) (*sql.Stmt, error)

func (*Table) BuildFilterStatement

func (t *Table) BuildFilterStatement(
	db *sql.DB,
	filterCols *TableColumns,
	selectCols *TableColumns,
	orderByCols *TableColumns,
	limit int,
) (*sql.Stmt, error)

func (*Table) BuildUpdateStatement

func (t *Table) BuildUpdateStatement(
	db *sql.DB,
	filterCols *TableColumns,
	updateCols *TableColumns,
) (*sql.Stmt, error)

type TableColumns

type TableColumns []string

Table Helpers

type TableManager

type TableManager interface {
	// Get Operations
	GetOne(*Query) []BaseModel
	GetMultiple(*Query) []BaseModel

	// Creation Operations
	CreateOne(*CreateParams) BaseModel
	CreateMultiple(*[]BaseModel) []BaseModel

	// Update Operations
	UpdateOne(*UpdateParams) int
	UpdateMultiple(*UpdateParams) int

	// Delete Operations
	DeleteOne(*DeleteParams) int
	DeleteMultiple(*DeleteParams) int

	// Query Helpers -- should these be privare
	BuildCreateStatment(db *sql.DB) (*sql.Stmt, error)
	BuildUpdateStatement(db *sql.DB) (*sql.Stmt, error)
	BuildFilterStatement(db *sql.DB) (*sql.Stmt, error)
	// contains filtered or unexported methods
}

type UpdateParams

type UpdateParams struct{}

use for updating objects

Jump to

Keyboard shortcuts

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