Documentation ¶
Index ¶
- func NewDatabase() *sql.DB
- type Paste
- type PasteStore
- func (store *PasteStore) Delete(id int64) error
- func (store *PasteStore) Insert(paste *Paste) (*Paste, error)
- func (store *PasteStore) SearchList(filter string, limit int64, offset int64) ([]*Paste, error)
- func (store *PasteStore) Select(id int64) (*Paste, error)
- func (store *PasteStore) SelectList(limit int64, offset int64) ([]*Paste, error)
- type Scannable
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Paste ¶
type Paste struct { ID int64 Title string RawContent string FormattedContent string IsPublic bool Language string TimeCreated time.Time Duration time.Duration }
Paste represents the paste contents and surrounding metadata.
func (*Paste) MarshalBinary ¶
MarshalBinary converts the paste to a binary array.
func (*Paste) UnmarshalBinary ¶
UnmarshalBinary converts a binary array to paste.
type PasteStore ¶
type PasteStore struct {
// contains filtered or unexported fields
}
PasteStore is the store for pastes.
func NewPasteStore ¶
func NewPasteStore(db *sql.DB) *PasteStore
NewPasteStore creates a new PasteStore instance.
func (*PasteStore) Delete ¶
func (store *PasteStore) Delete(id int64) error
Delete deletes the paste with the given id from the database.
func (*PasteStore) Insert ¶
func (store *PasteStore) Insert(paste *Paste) (*Paste, error)
Insert inserts a new paste to the database.
func (*PasteStore) SearchList ¶
SearchList returns a list of public pastes sorted by their creation time and matching given filter.
func (*PasteStore) Select ¶
func (store *PasteStore) Select(id int64) (*Paste, error)
Select returns the paste with the given id from the database.
func (*PasteStore) SelectList ¶
func (store *PasteStore) SelectList(limit int64, offset int64) ([]*Paste, error)
SelectList returns a slice of public pastes sorted by their creation time.
Click to show internal directories.
Click to hide internal directories.