fix []byte implimentation
This commit is contained in:
parent
5c863f56bd
commit
bf14e74520
@ -5,7 +5,6 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal/sqlcgen"
|
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal/sqlcgen"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
|
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
|
||||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/pj_errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type TgRepo struct {
|
type TgRepo struct {
|
||||||
@ -42,19 +41,19 @@ func (r *TgRepo) CreateTgAccount(ctx context.Context, data model.TgAccount) (int
|
|||||||
func (r *TgRepo) GetAllTgAccounts(ctx context.Context) ([]model.TgAccount, error) {
|
func (r *TgRepo) GetAllTgAccounts(ctx context.Context) ([]model.TgAccount, error) {
|
||||||
rows, err := r.queries.GetAllTgAccounts(ctx)
|
rows, err := r.queries.GetAllTgAccounts(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == sql.ErrNoRows {
|
|
||||||
return nil, pj_errors.ErrNotFound
|
|
||||||
}
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var result []model.TgAccount
|
var result []model.TgAccount
|
||||||
for _, row := range rows {
|
for _, row := range rows {
|
||||||
|
var status model.TgAccountStatus
|
||||||
|
s := string(row.Status.([]byte))
|
||||||
|
status = model.TgAccountStatus(s)
|
||||||
result = append(result, model.TgAccount{
|
result = append(result, model.TgAccount{
|
||||||
ID: row.ID,
|
ID: row.ID,
|
||||||
ApiID: row.Apiid,
|
ApiID: row.Apiid,
|
||||||
ApiHash: row.Apihash,
|
ApiHash: row.Apihash,
|
||||||
PhoneNumber: row.Phonenumber,
|
PhoneNumber: row.Phonenumber,
|
||||||
Status: row.Status.(model.TgAccountStatus),
|
Status: status,
|
||||||
Deleted: row.Deleted,
|
Deleted: row.Deleted,
|
||||||
CreatedAt: row.Createdat,
|
CreatedAt: row.Createdat,
|
||||||
Password: row.Password,
|
Password: row.Password,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user