internal

package
v0.0.0-...-adce95b Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextKey

type ContextKey int
const (
	KeySessionNpub ContextKey = iota
)

type Page

type Page struct {
	// contains filtered or unexported fields
}

func NewHandlers

func NewHandlers(store *SQLStore) *Page

func (*Page) Login

func (page *Page) Login(w http.ResponseWriter, r *http.Request)

func (*Page) Logout

func (page *Page) Logout(w http.ResponseWriter, r *http.Request)

func (*Page) RenderAbout

func (page *Page) RenderAbout(w http.ResponseWriter, r *http.Request)

func (*Page) RenderAllPost

func (page *Page) RenderAllPost(w http.ResponseWriter, r *http.Request)

func (*Page) RenderDashboard

func (page *Page) RenderDashboard(w http.ResponseWriter, r *http.Request)

func (*Page) RenderIndex

func (page *Page) RenderIndex(w http.ResponseWriter, r *http.Request)

func (*Page) RenderNewPost

func (page *Page) RenderNewPost(w http.ResponseWriter, r *http.Request)

func (*Page) RenderOnePost

func (page *Page) RenderOnePost(w http.ResponseWriter, r *http.Request)

func (*Page) SaveNewPost

func (page *Page) SaveNewPost(w http.ResponseWriter, r *http.Request)

type Post

type Post struct {
	ID        int64     `db:"id"`
	Npub      string    `db:"npub"`
	Body      string    `db:"body"`
	RelayList string    `db:"relaylist"`
	CreatedAt time.Time `db:"created_at"`
}

type SQLStore

type SQLStore struct {
	// contains filtered or unexported fields
}

func NewSQLStore

func NewSQLStore(db *sqlx.DB) *SQLStore

func (*SQLStore) GetAllPostByNpub

func (s *SQLStore) GetAllPostByNpub(
	ctx context.Context,
	npub string,
) ([]*Post, error)

func (*SQLStore) GetOnePost

func (s *SQLStore) GetOnePost(
	ctx context.Context,
	id int64,
) (*Post, error)

func (*SQLStore) InsertPost

func (s *SQLStore) InsertPost(
	ctx context.Context,
	d *Post,
) (int64, error)

Jump to

Keyboard shortcuts

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