Documentation ¶
Index ¶
- type Config
- type PostgresqlContainer
- type Store
- func (u Store) GetURLByID(ctx context.Context, id uuid.UUID) (store.URL, error)
- func (u Store) GetURLByLongStr(ctx context.Context, longURL string) (store.URL, error)
- func (u Store) GetURLByParam(ctx context.Context, param string) (store.URL, error)
- func (s Store) GetUserByEmail(ctx context.Context, email string) (store.User, error)
- func (s Store) GetUserByID(ctx context.Context, id uuid.UUID) (store.User, error)
- func (s Store) GetUserByVerificationToken(ctx context.Context, token uuid.UUID) (store.User, error)
- func (u Store) NewURL(ctx context.Context, userID uuid.UUID, originalURL, shortenedURLParam string) (store.URL, error)
- func (s Store) NewUser(ctx context.Context, email, password string) (store.User, error)
- func (s Store) SetUserAPIKey(ctx context.Context, id, key uuid.UUID) error
- func (s Store) SetUserVerified(ctx context.Context, id uuid.UUID) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { //Host e.g. localhost:5432 Host string //Password is the database user's password Password string //User is the database username User string //Name is the database name Name string //MaxIdleConns is the maximum number of conns in the idle conn pool MaxIdleConns int //MaxOpenConns is the maximum number of open conns to the database. MaxOpenConns int //DisableTLS enable TLS on connections to the database. DisableTLS bool }
type PostgresqlContainer ¶
type PostgresqlContainer struct {
// contains filtered or unexported fields
}
func NewPostgresqlContainer ¶
func NewPostgresqlContainer(pool *dockertest.Pool) *PostgresqlContainer
func (*PostgresqlContainer) Create ¶
func (container *PostgresqlContainer) Create(t *testing.T)
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a postgresql implementation of our store interface
func NewStore ¶
NewStore creates and returns an initialized postgresql store for use as our state backend.
func NewTestDatabase ¶
func (Store) GetURLByID ¶
GetURLByID retrieves the short url by its given id.
func (Store) GetURLByLongStr ¶
GetURLByLongStr retrieves the short url of the given long url.
func (Store) GetURLByParam ¶
GetURLByParam retrieves the short url by its given param.
func (Store) GetUserByEmail ¶
GetUserByEmail retrieves an existing user with the given email.
func (Store) GetUserByID ¶
GetUserByID finds a user by id
func (Store) GetUserByVerificationToken ¶
GetUserByVerificationToken retrieves user whose verification token matches the given token string.
func (Store) NewURL ¶
func (u Store) NewURL(ctx context.Context, userID uuid.UUID, originalURL, shortenedURLParam string) (store.URL, error)
NewURL creates a new url record.
func (Store) SetUserAPIKey ¶
SetUserAPIKey sets the api key for the given user id.
Click to show internal directories.
Click to hide internal directories.