Documentation ¶
Index ¶
- type Connection
- type HTTPManager
- func (m *HTTPManager) Create(connection *Connection) error
- func (m *HTTPManager) Delete(id string) error
- func (m *HTTPManager) FindAllByLocalSubject(subject string) ([]*Connection, error)
- func (m *HTTPManager) FindByRemoteSubject(provider, subject string) (*Connection, error)
- func (m *HTTPManager) Get(id string) (*Connection, error)
- type Handler
- func (h *Handler) Create(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (h *Handler) Delete(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (h *Handler) FindLocal(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (h *Handler) FindRemote(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (h *Handler) Get(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (h *Handler) SetRoutes(r *httprouter.Router)
- type Manager
- type MemoryManager
- func (m *MemoryManager) Create(c *Connection) error
- func (m *MemoryManager) Delete(id string) error
- func (m *MemoryManager) FindAllByLocalSubject(subject string) ([]*Connection, error)
- func (m *MemoryManager) FindByRemoteSubject(provider, subject string) (*Connection, error)
- func (m *MemoryManager) Get(id string) (*Connection, error)
- type RethinkManager
- func (m *RethinkManager) ColdStart() error
- func (m *RethinkManager) Create(c *Connection) error
- func (m *RethinkManager) Delete(id string) error
- func (m *RethinkManager) FindAllByLocalSubject(subject string) ([]*Connection, error)
- func (m *RethinkManager) FindByRemoteSubject(provider, subject string) (*Connection, error)
- func (m *RethinkManager) Get(id string) (*Connection, error)
- func (m *RethinkManager) Watch(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { ID string `json:"id,omitempty" gorethink:"id"` Provider string `json:"provider" valid:"required" gorethink:"provider"` LocalSubject string `json:"localSubject" valid:"required" gorethink:"localsubject"` RemoteSubject string `json:"remoteSubject" valid:"required" gorethink:"remotesubject"` }
Connection connects an subject S with a token T issued by provider P
func (*Connection) GetID ¶
func (c *Connection) GetID() string
GetID returns the connection's unique identifier.
func (*Connection) GetLocalSubject ¶
func (c *Connection) GetLocalSubject() string
GetLocalSubject returns the connection's local subject, for example "peter".
func (*Connection) GetProvider ¶
func (c *Connection) GetProvider() string
GetProvider returns the connection's provider, for example "Google".
func (*Connection) GetRemoteSubject ¶
func (c *Connection) GetRemoteSubject() string
GetRemoteSubject returns the connection's remote subject, for example "peter@gmail.com".
type HTTPManager ¶
func (*HTTPManager) Create ¶
func (m *HTTPManager) Create(connection *Connection) error
func (*HTTPManager) Delete ¶
func (m *HTTPManager) Delete(id string) error
func (*HTTPManager) FindAllByLocalSubject ¶
func (m *HTTPManager) FindAllByLocalSubject(subject string) ([]*Connection, error)
func (*HTTPManager) FindByRemoteSubject ¶
func (m *HTTPManager) FindByRemoteSubject(provider, subject string) (*Connection, error)
func (*HTTPManager) Get ¶
func (m *HTTPManager) Get(id string) (*Connection, error)
type Handler ¶
func (*Handler) Create ¶
func (h *Handler) Create(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func (*Handler) Delete ¶
func (h *Handler) Delete(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func (*Handler) FindLocal ¶
func (h *Handler) FindLocal(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func (*Handler) FindRemote ¶
func (h *Handler) FindRemote(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func (*Handler) Get ¶
func (h *Handler) Get(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
func (*Handler) SetRoutes ¶
func (h *Handler) SetRoutes(r *httprouter.Router)
type Manager ¶
type Manager interface { // Create a new connection. Create(c *Connection) error // Delete an existing connection. Delete(id string) error // Get an existing connection. Get(id string) (*Connection, error) FindAllByLocalSubject(subject string) ([]*Connection, error) FindByRemoteSubject(provider, subject string) (*Connection, error) }
Storage defines an interface for storing connections.
type MemoryManager ¶
type MemoryManager struct { Connections map[string]*Connection sync.RWMutex }
func NewMemoryManager ¶
func NewMemoryManager() *MemoryManager
func (*MemoryManager) Create ¶
func (m *MemoryManager) Create(c *Connection) error
func (*MemoryManager) Delete ¶
func (m *MemoryManager) Delete(id string) error
func (*MemoryManager) FindAllByLocalSubject ¶
func (m *MemoryManager) FindAllByLocalSubject(subject string) ([]*Connection, error)
func (*MemoryManager) FindByRemoteSubject ¶
func (m *MemoryManager) FindByRemoteSubject(provider, subject string) (*Connection, error)
func (*MemoryManager) Get ¶
func (m *MemoryManager) Get(id string) (*Connection, error)
type RethinkManager ¶
type RethinkManager struct { Session *r.Session Table r.Term Connections map[string]*Connection sync.RWMutex }
func (*RethinkManager) ColdStart ¶
func (m *RethinkManager) ColdStart() error
func (*RethinkManager) Create ¶
func (m *RethinkManager) Create(c *Connection) error
func (*RethinkManager) Delete ¶
func (m *RethinkManager) Delete(id string) error
func (*RethinkManager) FindAllByLocalSubject ¶
func (m *RethinkManager) FindAllByLocalSubject(subject string) ([]*Connection, error)
func (*RethinkManager) FindByRemoteSubject ¶
func (m *RethinkManager) FindByRemoteSubject(provider, subject string) (*Connection, error)
func (*RethinkManager) Get ¶
func (m *RethinkManager) Get(id string) (*Connection, error)
func (*RethinkManager) Watch ¶
func (m *RethinkManager) Watch(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.