links

package
v0.0.0-...-bb61026 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadRoutes

func LoadRoutes(r chi.Router, config config.Config, store *store.PostgresStore)

Types

type Link struct {
	CreatedAt   time.Time  `db:"created_at" json:"created_at"`
	UpdatedAt   *time.Time `db:"updated_at" json:"updated_at"`
	FolderId    *string    `db:"folder_id" validate:"omitempty,uuid" json:"folder_id"`
	ExpiresAt   *time.Time `db:"expires_at" validate:"omitempty,expires_at" json:"expires_at"`
	Id          string     `db:"id" json:"id"`
	LinktlyCode string     `db:"linktly_code" validate:"omitempty,http_url" json:"linktly_url"`
	Url         string     `db:"url" validate:"http_url" json:"url"`
	Name        string     `db:"name" validate:"required,min=3,max=255" json:"name"`
	AccountId   string     `db:"account_id" validate:"omitempty,uuid" json:"account_id"`
	Description string     `db:"description" validate:"min=10" json:"description"`
}

type LinkIdReq

type LinkIdReq struct {
	Id string `validate:"required,uuid"`
}

type LinkReq

type LinkReq struct {
	*Link
}

func (*LinkReq) Bind

func (req *LinkReq) Bind(r *http.Request) error

type LinkResp

type LinkResp struct {
	*Link
}

func (*LinkResp) Render

func (res *LinkResp) Render(w http.ResponseWriter, r *http.Request) error

type LinksHandler

type LinksHandler struct {
	// contains filtered or unexported fields
}
func (l LinksHandler) CreateLink(w http.ResponseWriter, r *http.Request) error
func (l LinksHandler) GetLink(w http.ResponseWriter, r *http.Request) error

type LinksService

type LinksService struct {
	Repository linksRepository
}
func (l *LinksService) CreateLink(ctx context.Context, link *Link) (*Link, error)
func (l *LinksService) GetLink(ctx context.Context, id string, userId string) (*Link, error)

type PostgresRepository

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

func GetNewLinkRepository

func GetNewLinkRepository(store *store.PostgresStore) *PostgresRepository
func (repo *PostgresRepository) CreateLink(ctx context.Context, link *Link) (*Link, error)
func (repo *PostgresRepository) GetLink(ctx context.Context, id string, userId string) (*Link, error)

func (*PostgresRepository) GetLinksByFolderId

func (repo *PostgresRepository) GetLinksByFolderId(ctx context.Context, folderId string, userId string) ([]*Link, error)

Jump to

Keyboard shortcuts

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