collections

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthCtx

func AuthCtx(ctx context.Context, token string) context.Context

Types

type Bucket

type Bucket struct {
	ID        string
	Path      string
	Name      string
	ProjectID string
	Created   int64
	Updated   int64
}

type Buckets

type Buckets struct {
	// contains filtered or unexported fields
}

func (*Buckets) Create

func (f *Buckets) Create(
	ctx context.Context,
	pth path.Resolved,
	name string,
	projectID string,
) (*Bucket, error)

func (*Buckets) Delete

func (f *Buckets) Delete(ctx context.Context, id string) error

func (*Buckets) GetByName

func (f *Buckets) GetByName(ctx context.Context, name string) (*Bucket, error)

func (*Buckets) GetIndexes

func (f *Buckets) GetIndexes() []*s.IndexConfig

func (*Buckets) GetInstance

func (f *Buckets) GetInstance() interface{}

func (*Buckets) GetName

func (f *Buckets) GetName() string

func (*Buckets) GetStoreID

func (f *Buckets) GetStoreID() *uuid.UUID

func (*Buckets) List

func (f *Buckets) List(ctx context.Context, projectID string) ([]*Bucket, error)

func (*Buckets) Save

func (f *Buckets) Save(ctx context.Context, bucket *Bucket) error

type Collection

type Collection interface {
	GetName() string
	GetInstance() interface{}
	GetIndexes() []*store.IndexConfig
	GetStoreID() *uuid.UUID
}

type Collections

type Collections struct {
	Developers *Developers
	Sessions   *Sessions
	Teams      *Teams
	Invites    *Invites
	Projects   *Projects

	Tokens *Tokens
	Users  *Users

	Buckets *Buckets
	// contains filtered or unexported fields
}

func NewCollections

func NewCollections(
	ctx context.Context,
	threads *client.Client,
	token string,
	ds datastore.Datastore,
) (c *Collections, err error)

NewCollections gets or create store instances for active collections.

type Developer

type Developer struct {
	ID      string
	Email   string
	Teams   []string
	Created int64
}

type Developers

type Developers struct {
	// contains filtered or unexported fields
}

func (*Developers) Create

func (d *Developers) Create(ctx context.Context, email string) (*Developer, error)

func (*Developers) Delete

func (d *Developers) Delete(ctx context.Context, id string) error

@todo: Developer must first delete projects and teams they own @todo: Delete associated sessions

func (*Developers) Get

func (d *Developers) Get(ctx context.Context, id string) (*Developer, error)

func (*Developers) GetByEmail

func (d *Developers) GetByEmail(ctx context.Context, email string) (*Developer, error)

func (*Developers) GetIndexes

func (d *Developers) GetIndexes() []*s.IndexConfig

func (*Developers) GetInstance

func (d *Developers) GetInstance() interface{}

func (*Developers) GetName

func (d *Developers) GetName() string

func (*Developers) GetOrCreateByEmail

func (d *Developers) GetOrCreateByEmail(ctx context.Context, email string) (*Developer, error)

func (*Developers) GetStoreID

func (d *Developers) GetStoreID() *uuid.UUID

func (*Developers) HasTeam

func (d *Developers) HasTeam(dev *Developer, teamID string) bool

func (*Developers) JoinTeam

func (d *Developers) JoinTeam(ctx context.Context, dev *Developer, teamID string) error

func (*Developers) LeaveTeam

func (d *Developers) LeaveTeam(ctx context.Context, dev *Developer, teamID string) error

func (*Developers) ListByTeam

func (d *Developers) ListByTeam(ctx context.Context, teamID string) ([]*Developer, error)

type Invite

type Invite struct {
	ID      string
	TeamID  string
	FromID  string
	ToEmail string
	Expiry  int
}

type Invites

type Invites struct {
	// contains filtered or unexported fields
}

func (*Invites) Create

func (i *Invites) Create(ctx context.Context, teamID, fromID, toEmail string) (*Invite, error)

func (*Invites) Delete

func (i *Invites) Delete(ctx context.Context, id string) error

func (*Invites) Get

func (i *Invites) Get(ctx context.Context, id string) (*Invite, error)

func (*Invites) GetIndexes

func (i *Invites) GetIndexes() []*s.IndexConfig

func (*Invites) GetInstance

func (i *Invites) GetInstance() interface{}

func (*Invites) GetName

func (i *Invites) GetName() string

func (*Invites) GetStoreID

func (i *Invites) GetStoreID() *uuid.UUID

type Project

type Project struct {
	ID      string
	Name    string
	Scope   string // user or team
	StoreID string
	Address string
	Created int64
}

type Projects

type Projects struct {
	// contains filtered or unexported fields
}

func (*Projects) Create

func (p *Projects) Create(ctx context.Context, name, scope, addr string) (*Project, error)

func (*Projects) Delete

func (p *Projects) Delete(ctx context.Context, id string) error

func (*Projects) Get

func (p *Projects) Get(ctx context.Context, id string) (*Project, error)

func (*Projects) GetByName

func (p *Projects) GetByName(ctx context.Context, name string) (*Project, error)

func (*Projects) GetIndexes

func (p *Projects) GetIndexes() []*s.IndexConfig

func (*Projects) GetInstance

func (p *Projects) GetInstance() interface{}

func (*Projects) GetName

func (p *Projects) GetName() string

func (*Projects) GetStoreID

func (p *Projects) GetStoreID() *uuid.UUID

func (*Projects) List

func (p *Projects) List(ctx context.Context, scope string) ([]*Project, error)

type Session

type Session struct {
	ID     string
	UserID string // dev or user
	Scope  string // dev or team ID
	Expiry int
}

type Sessions

type Sessions struct {
	// contains filtered or unexported fields
}

func (*Sessions) Create

func (s *Sessions) Create(ctx context.Context, userID, scope string) (*Session, error)

func (*Sessions) Delete

func (s *Sessions) Delete(ctx context.Context, id string) error

func (*Sessions) Get

func (s *Sessions) Get(ctx context.Context, id string) (*Session, error)

func (*Sessions) GetIndexes

func (s *Sessions) GetIndexes() []*store.IndexConfig

func (*Sessions) GetInstance

func (s *Sessions) GetInstance() interface{}

func (*Sessions) GetName

func (s *Sessions) GetName() string

func (*Sessions) GetStoreID

func (s *Sessions) GetStoreID() *uuid.UUID

func (*Sessions) Save

func (s *Sessions) Save(ctx context.Context, session *Session) error

func (*Sessions) Touch

func (s *Sessions) Touch(ctx context.Context, session *Session) error

type Team

type Team struct {
	ID      string
	OwnerID string
	Name    string
	Created int64
}

type Teams

type Teams struct {
	// contains filtered or unexported fields
}

func (*Teams) Create

func (t *Teams) Create(ctx context.Context, ownerID, name string) (*Team, error)

func (*Teams) Delete

func (t *Teams) Delete(ctx context.Context, id string) error

func (*Teams) Get

func (t *Teams) Get(ctx context.Context, id string) (*Team, error)

func (*Teams) GetIndexes

func (t *Teams) GetIndexes() []*s.IndexConfig

func (*Teams) GetInstance

func (t *Teams) GetInstance() interface{}

func (*Teams) GetName

func (t *Teams) GetName() string

func (*Teams) GetStoreID

func (t *Teams) GetStoreID() *uuid.UUID

type Token

type Token struct {
	ID        string
	ProjectID string
}

type TokenAuth

type TokenAuth struct{}

func (TokenAuth) GetRequestMetadata

func (t TokenAuth) GetRequestMetadata(ctx context.Context, _ ...string) (map[string]string, error)

func (TokenAuth) RequireTransportSecurity

func (t TokenAuth) RequireTransportSecurity() bool

type Tokens

type Tokens struct {
	// contains filtered or unexported fields
}

func (*Tokens) Create

func (a *Tokens) Create(ctx context.Context, projectID string) (*Token, error)

func (*Tokens) Delete

func (a *Tokens) Delete(ctx context.Context, id string) error

func (*Tokens) Get

func (a *Tokens) Get(ctx context.Context, id string) (*Token, error)

func (*Tokens) GetIndexes

func (a *Tokens) GetIndexes() []*s.IndexConfig

func (*Tokens) GetInstance

func (a *Tokens) GetInstance() interface{}

func (*Tokens) GetName

func (a *Tokens) GetName() string

func (*Tokens) GetStoreID

func (a *Tokens) GetStoreID() *uuid.UUID

func (*Tokens) List

func (a *Tokens) List(ctx context.Context, projectID string) ([]*Token, error)

type User

type User struct {
	ID        string
	DeviceID  string
	ProjectID string
	StoreID   string
	Created   int64
}

type Users

type Users struct {
	// contains filtered or unexported fields
}

func (*Users) Delete

func (u *Users) Delete(ctx context.Context, id string) error

@todo: Delete associated sessions

func (*Users) Get

func (u *Users) Get(ctx context.Context, id string) (*User, error)

func (*Users) GetByDeviceID

func (u *Users) GetByDeviceID(ctx context.Context, deviceID string) (*User, error)

func (*Users) GetIndexes

func (u *Users) GetIndexes() []*s.IndexConfig

func (*Users) GetInstance

func (u *Users) GetInstance() interface{}

func (*Users) GetName

func (u *Users) GetName() string

func (*Users) GetOrCreate

func (u *Users) GetOrCreate(ctx context.Context, projectID, deviceID string) (user *User, err error)

func (*Users) GetStoreID

func (u *Users) GetStoreID() *uuid.UUID

func (*Users) List

func (u *Users) List(ctx context.Context, projectID string) ([]*User, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL