Documentation ¶
Index ¶
- Constants
- Variables
- func DropAllTables(ds datastore.DataStore)
- func InitAuthContexts()
- func InitLog() *logrus.Logger
- func InitMetadataAuthorizer()
- func InitTestData(dbName string)
- func PrepareInput() (*App, *AppUser, *AppUser)
- func RecreateAllTables(ds datastore.DataStore)
- func SetupDataStore(dbName string) (datastore.DataStore, protostore.ProtoStore)
- func SetupDataStoreNoInstancer(dbName string) (datastore.DataStore, protostore.ProtoStore)
- func SetupDbTables(ds datastore.DataStore) (*App, *AppUser, *AppUser)
- type App
- type AppUser
- type AppUserSlice
- type Group
Constants ¶
View Source
const ( // Organizations. COKE = "Coke" PEPSI = "Pepsi" // Instances. AMERICAS = "Americas" EUROPE = "Europe" )
View Source
const ( TENANT_AUDITOR = "tenant_auditor" TENANT_ADMIN = "tenant_admin" SERVICE_AUDITOR = "service_auditor" SERVICE_ADMIN = "service_admin" )
Service roles for test cases.
Variables ¶
View Source
var ( RANDOM_ID string = uuid.New().String() TestMetadataAuthorizer = &authorizer.MetadataBasedAuthorizer{} TestInstancer = &authorizer.SimpleInstancer{} ServiceAdminCtx = TestMetadataAuthorizer.GetAuthContext("", SERVICE_ADMIN) ServiceAuditorCtx = TestMetadataAuthorizer.GetAuthContext("", SERVICE_AUDITOR) CokeAdminCtx = TestMetadataAuthorizer.GetAuthContext(COKE, TENANT_ADMIN) CokeAuditorCtx = TestMetadataAuthorizer.GetAuthContext(COKE, TENANT_AUDITOR) PepsiAdminCtx = TestMetadataAuthorizer.GetAuthContext(PEPSI, TENANT_ADMIN) PepsiAuditorCtx = TestMetadataAuthorizer.GetAuthContext(PEPSI, TENANT_AUDITOR) AmericasCokeAdminCtx = TestInstancer.WithInstanceId(CokeAdminCtx, AMERICAS) AmericasCokeAuditorCtx = TestInstancer.WithInstanceId(CokeAuditorCtx, AMERICAS) AmericasPepsiAdminCtx = TestInstancer.WithInstanceId(PepsiAdminCtx, AMERICAS) EuropeCokeAdminCtx = TestInstancer.WithInstanceId(CokeAdminCtx, EUROPE) EuropeCokeAuditorCtx = TestInstancer.WithInstanceId(CokeAuditorCtx, EUROPE) )
View Source
var ( LOG *logrus.Entry DS datastore.DataStore PS protostore.ProtoStore RS realization_store.IRealizationStore NO_ROLE dbrole.DbRole TestAuthorizer authorizer.Authorizer )
TODO: Get rid of global variables.
Functions ¶
func DropAllTables ¶
func InitAuthContexts ¶ added in v0.0.13
func InitAuthContexts()
func InitMetadataAuthorizer ¶ added in v0.0.13
func InitMetadataAuthorizer()
func InitTestData ¶ added in v0.0.13
func InitTestData(dbName string)
func PrepareInput ¶
func RecreateAllTables ¶
func SetupDataStore ¶ added in v0.0.6
func SetupDataStore(dbName string) (datastore.DataStore, protostore.ProtoStore)
func SetupDataStoreNoInstancer ¶ added in v0.0.10
func SetupDataStoreNoInstancer(dbName string) (datastore.DataStore, protostore.ProtoStore)
Types ¶
type App ¶
type App struct { Id string `gorm:"primaryKey;column:application_id"` Name string TenantId string `gorm:"primaryKey;column:org_id"` CreatedAt time.Time UpdatedAt time.Time DeletedAt gorm.DeletedAt }
func (App) AreNonKeyFieldsEmpty ¶
type AppUser ¶
type AppUser struct { Id string `gorm:"primaryKey;column:user_id"` Name string Email string EmailConfirmed bool NumFollowing int32 NumFollowers int64 AppId string Msg []byte CreatedAt time.Time UpdatedAt time.Time DeletedAt gorm.DeletedAt }
func (AppUser) AreNonKeyFieldsEmpty ¶
type AppUserSlice ¶
type AppUserSlice []AppUser // Needed for sorting
func (AppUserSlice) Len ¶
func (a AppUserSlice) Len() int
func (AppUserSlice) Less ¶
func (a AppUserSlice) Less(x, y int) bool
func (AppUserSlice) Swap ¶
func (a AppUserSlice) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.