2025-02-13 20:32:19 +00:00
|
|
|
package android
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
2025-02-24 20:31:21 +00:00
|
|
|
|
|
|
|
|
"github.com/jmoiron/sqlx"
|
2025-02-13 20:32:19 +00:00
|
|
|
)
|
|
|
|
|
|
2025-02-28 22:30:40 +00:00
|
|
|
// MySQLTables are the tables that are present in Android's schema.sql
|
|
|
|
|
// This is an optimization/encapsulation exercise -- Android Datastore is only unit tested with the tables it uses.
|
|
|
|
|
func MySQLTables() []string {
|
|
|
|
|
return []string{
|
|
|
|
|
"android_enterprises",
|
|
|
|
|
"android_devices",
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-13 20:32:19 +00:00
|
|
|
type Datastore interface {
|
2025-02-27 20:19:15 +00:00
|
|
|
CreateEnterprise(ctx context.Context, userID uint) (uint, error)
|
2025-09-22 18:17:11 +00:00
|
|
|
GetEnterpriseByID(ctx context.Context, id uint) (*EnterpriseDetails, error)
|
2025-02-28 21:08:04 +00:00
|
|
|
GetEnterpriseBySignupToken(ctx context.Context, signupToken string) (*EnterpriseDetails, error)
|
2025-02-18 15:43:11 +00:00
|
|
|
GetEnterprise(ctx context.Context) (*Enterprise, error)
|
2025-02-24 20:31:21 +00:00
|
|
|
UpdateEnterprise(ctx context.Context, enterprise *EnterpriseDetails) error
|
2025-02-26 16:47:05 +00:00
|
|
|
DeleteAllEnterprises(ctx context.Context) error
|
2025-09-22 18:17:11 +00:00
|
|
|
DeleteOtherEnterprises(ctx context.Context, id uint) error
|
2025-02-24 20:31:21 +00:00
|
|
|
|
|
|
|
|
CreateDeviceTx(ctx context.Context, tx sqlx.ExtContext, device *Device) (*Device, error)
|
|
|
|
|
UpdateDeviceTx(ctx context.Context, tx sqlx.ExtContext, device *Device) error
|
2025-02-13 20:32:19 +00:00
|
|
|
}
|