Documentation ¶
Index ¶
- Constants
- type DbPool
- func (p *DbPool) CloseConnection() error
- func (p *DbPool) CreateAllTables() error
- func (p *DbPool) DropAllTables() error
- func (p *DbPool) InsertDevice(d *Device) error
- func (p *DbPool) InsertUser(users *NewUser) error
- func (p *DbPool) ListAllDevices() ([]Device, error)
- func (p *DbPool) ListAllUsers() ([]User, error)
- type Device
- type NewUser
- type PgxPool
- func (p *PgxPool) CreateAllTables(ctx context.Context) ([]Device, error)
- func (p *PgxPool) FindUserName(ctx context.Context, users *NewUser) error
- func (p *PgxPool) InsertArticle(ctx context.Context, users *NewUser) error
- func (p *PgxPool) InsertDevice(ctx context.Context, users *NewUser) error
- func (p *PgxPool) InsertUser(ctx context.Context, users *NewUser) error
- func (p *PgxPool) ListAllArticles(ctx context.Context) error
- func (p *PgxPool) ListAllDevices(ctx context.Context) ([]Device, error)
- func (p *PgxPool) ListAllUsers(ctx context.Context) ([]User, error)
- func (p *PgxPool) PgxCloseConnection(ctx context.Context) error
- type User
Constants ¶
const ( // InsertDeviceSQL adds a devics) InsertDeviceSQL = `` /* 202-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DbPool ¶
DbPool struct wraps the db instance
func SqlxNewInstance ¶
SqlxNewInstance create DbPool instance
func (*DbPool) CloseConnection ¶
CloseConnection closes connetion
func (*DbPool) CreateAllTables ¶
CreateAllTables initializes the
func (*DbPool) InsertDevice ¶
InsertDevice a record into device table
func (*DbPool) InsertUser ¶
InsertUser inserts a single user to the database
func (*DbPool) ListAllDevices ¶
ListAllDevices list all devices
func (*DbPool) ListAllUsers ¶
ListAllUsers list all users
type Device ¶
type Device struct { ID string `json:"id"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` DeletedAt string `json:"deleted_at"` PhoneBrand string `json:"phone_brand"` PhoneModel string `json:"phone_model"` PushID string `json:"push_id"` DeviceID string `json:"device_id"` }
Device model for storing device table rows
type NewUser ¶
type NewUser struct { Name string `json:"Name" valid:"required"` Email string `json:"Email" valid:"required,email"` Mobile string `json:"Mobile" valid:"required,numeric"` Password string `json:"Password" valid:"required,minstringlength(8)"` DeviceID string `json:"DeviceID" valid:"optional"` }
NewUser to check input
type PgxPool ¶
type PgxPool struct {
// contains filtered or unexported fields
}
PgxPool is the Pgx connection pool
func PgxNewConnection ¶
PgxNewConnection initialize connection pol
func (*PgxPool) CreateAllTables ¶
CreateAllTables queries for a user name
func (*PgxPool) FindUserName ¶
FindUserName queries for a user name
func (*PgxPool) InsertArticle ¶
InsertArticle inserts a single user to the database
func (*PgxPool) InsertDevice ¶
InsertDevice inserts a single user to the database
func (*PgxPool) InsertUser ¶
InsertUser inserts a single user to the database
func (*PgxPool) ListAllArticles ¶
ListAllArticles queries for a user name
func (*PgxPool) ListAllDevices ¶
ListAllDevices queries for a user name
func (*PgxPool) ListAllUsers ¶
ListAllUsers queries for a user name
type User ¶
type User struct { ID string `json:"id"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"update_at"` DeletedAt string `json:"deleted_at"` Username string `json:"username"` Phone string `json:"phone"` Email string `json:"email"` Password string `json:"password"` Pin int `json:"pin"` Device string `json:"device"` Role string `json:"role"` }
User model for storing user table rows