mirror of
https://github.com/openziti/zrok.git
synced 2024-12-22 23:02:52 +01:00
endpoint tracking (#10)
This commit is contained in:
parent
409fee1576
commit
4b3c22d02a
@ -9,14 +9,15 @@ type Service struct {
|
||||
Model
|
||||
AccountId int
|
||||
ZitiId string
|
||||
Endpoint string
|
||||
}
|
||||
|
||||
func (self *Store) CreateService(accountId int, svc *Service, tx *sqlx.Tx) (int, error) {
|
||||
stmt, err := tx.Prepare("insert into services (account_id, ziti_id) values (?, ?)")
|
||||
stmt, err := tx.Prepare("insert into services (account_id, ziti_id, endpoint) values (?, ?, ?)")
|
||||
if err != nil {
|
||||
return 0, errors.Wrap(err, "error preparing services insert statement")
|
||||
}
|
||||
res, err := stmt.Exec(accountId, svc.ZitiId)
|
||||
res, err := stmt.Exec(accountId, svc.ZitiId, svc.Endpoint)
|
||||
if err != nil {
|
||||
return 0, errors.Wrap(err, "error executing services insert statement")
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ create table services (
|
||||
id integer primary key,
|
||||
account_id integer constraint fk_accounts_services references accounts on delete cascade,
|
||||
ziti_id string not null unique,
|
||||
endpoint string,
|
||||
created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
|
||||
updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user