refactor sqlite db to support sqlc
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"go-nkode/config"
|
||||
"go-nkode/internal/models"
|
||||
"go-nkode/internal/security"
|
||||
"go-nkode/internal/sqlc"
|
||||
"go-nkode/internal/utils"
|
||||
)
|
||||
|
||||
@@ -83,3 +84,19 @@ func (c *Customer) RenewKeys() ([]uint64, []uint64, error) {
|
||||
}
|
||||
return setXor, attrsXor, nil
|
||||
}
|
||||
|
||||
func (c *Customer) ToSqlcCreateCustomerParams() sqlc.CreateCustomerParams {
|
||||
return sqlc.CreateCustomerParams{
|
||||
ID: uuid.UUID(c.Id).String(),
|
||||
MaxNkodeLen: int64(c.NKodePolicy.MaxNkodeLen),
|
||||
MinNkodeLen: int64(c.NKodePolicy.MinNkodeLen),
|
||||
DistinctSets: int64(c.NKodePolicy.DistinctSets),
|
||||
DistinctAttributes: int64(c.NKodePolicy.DistinctAttributes),
|
||||
LockOut: int64(c.NKodePolicy.LockOut),
|
||||
Expiration: int64(c.NKodePolicy.Expiration),
|
||||
AttributeValues: c.Attributes.AttrBytes(),
|
||||
SetValues: c.Attributes.SetBytes(),
|
||||
LastRenew: utils.TimeStamp(),
|
||||
CreatedAt: utils.TimeStamp(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user