postgres

package
v0.0.0-...-8717a1f Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateConnection

func CreateConnection(cfg config.PostgresConfig) (*sqlx.DB, error)

Types

type EventRepository

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

EventRepository is implementation of EventRepository interface of userland domain using postgre

func NewEventRepository

func NewEventRepository(conn *sqlx.DB) *EventRepository

NewEventRepository is constructor to create story repository

func (EventRepository) DeleteAllByUserID

func (s EventRepository) DeleteAllByUserID(userID int) error

func (EventRepository) FindAll

func (e EventRepository) FindAll(filter userland.EventFilterOptions, paging userland.EventPagingOptions) (events userland.Events, eventsCount int, err error)

Find User by id

func (EventRepository) Insert

func (e EventRepository) Insert(event userland.Event) error

type EventScanStruct

type EventScanStruct struct {
	ID         int
	UserID     int `db:"user_id"`
	Event      string
	UserAgent  sql.NullString `db:"user_agent"`
	IP         sql.NullString
	ClientID   int    `db:"client_id"`
	ClientName string `db:"client_name"`
	Timestamp  time.Time
	CreatedAt  time.Time `db:"created_at"`
}

type UserRepository

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

UserRepository is implementation of UserRepository interface of userland domain using postgre

func NewUserRepository

func NewUserRepository(conn *sqlx.DB) *UserRepository

NewUserRepository is constructor to create story repository

func (UserRepository) Delete

func (s UserRepository) Delete(id int) error

Delete delete story by id

func (UserRepository) Find

func (s UserRepository) Find(id int) (user userland.User, err error)

Find User by id

func (UserRepository) FindByEmail

func (s UserRepository) FindByEmail(email string) (user userland.User, err error)

FindByEmail User by email

func (UserRepository) Insert

func (s UserRepository) Insert(user *userland.User) error

Insert insert story to datastore

func (UserRepository) StoreBackupCodes

func (s UserRepository) StoreBackupCodes(user userland.User) error

func (UserRepository) Update

func (s UserRepository) Update(user userland.User) error

Update update story

type UserScanStruct

type UserScanStruct struct {
	ID           int
	Email        string
	Fullname     string
	Phone        sql.NullString
	Location     sql.NullString
	Bio          sql.NullString
	WebURL       sql.NullString `db:"web_url"`
	PictureURL   sql.NullString `db:"picture_url"`
	Password     string
	TFAEnabled   sql.NullBool `db:"tfa_enabled"`
	Verified     sql.NullBool
	BackupCodes  pq.StringArray `db:"backup_codes"`
	TFAEnabledAt pq.NullTime    `db:"tfa_enabled_at"`
	CreatedAt    time.Time      `db:"created_at"`
	UpdatedAt    time.Time      `db:"updated_at"`
}

Jump to

Keyboard shortcuts

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