Documentation ¶
Index ¶
- Constants
- func CreateTables(db *sqlx.DB)
- func DropTables(db *sqlx.DB)
- func FindCommentsByPostID(ctx context.Context, db SqlxDatabase, postID int) ([]*models.Comment, error)
- func FindPostByID(ctx context.Context, db SqlxDatabase, id int) (*models.Post, error)
- func SaveComment(ctx context.Context, db SqlxDatabase, c *models.Comment) error
- func SavePost(ctx context.Context, db SqlxDatabase, p *models.Post) error
- type SqlxDatabase
Constants ¶
View Source
const ( PostTable = "posts" CommentTable = "comments" )
Variables ¶
This section is empty.
Functions ¶
func CreateTables ¶
func DropTables ¶
func FindCommentsByPostID ¶
func FindPostByID ¶
func SaveComment ¶
Types ¶
type SqlxDatabase ¶
type SqlxDatabase interface { GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error PreparexContext(ctx context.Context, query string) (*sqlx.Stmt, error) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error }
Click to show internal directories.
Click to hide internal directories.