Documentation ¶
Overview ¶
This file contains the implementation of the MemberStorage interface for Neo4j.
Index ¶
- type FollowRequest
- type Follower
- type Input
- type Member
- type MemberStorer
- type Neo4jMemberStorage
- func (s Neo4jMemberStorage) Close() error
- func (s Neo4jMemberStorage) CreateSession(ctx context.Context, m *Member) (t string, err error)
- func (s Neo4jMemberStorage) Delete(ctx context.Context, member *Member) error
- func (s Neo4jMemberStorage) GetID(ctx context.Context, key string) (uint32, error)
- func (s Neo4jMemberStorage) GetPassHash(email, login string) (string, error)
- func (s Neo4jMemberStorage) Read(ctx context.Context, keyName, key string) (*Member, error)
- func (s Neo4jMemberStorage) RequestFollow(ctx context.Context, fr *FollowRequest) error
- func (s Neo4jMemberStorage) Save(ctx context.Context, member *Member) error
- func (s Neo4jMemberStorage) Update(ctx context.Context, member *Member) error
- type PgMemberStorage
- func (s *PgMemberStorage) CacheNicknames(ctx context.Context) error
- func (s *PgMemberStorage) CreateSession(ctx context.Context, m *Member) (t string, err error)
- func (s *PgMemberStorage) Delete(ctx context.Context, member *Member) error
- func (s *PgMemberStorage) GetID(ctx context.Context, credential string) (uint32, error)
- func (s *PgMemberStorage) GetNicknames() []string
- func (s *PgMemberStorage) GetPassHash(email, login string) (string, error)
- func (s *PgMemberStorage) Read(ctx context.Context, keyName, key string) (*Member, error)
- func (s *PgMemberStorage) RequestFollow(ctx context.Context, fr *FollowRequest) error
- func (s *PgMemberStorage) Save(ctx context.Context, member *Member) error
- func (s *PgMemberStorage) Update(ctx context.Context, member *Member) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FollowRequest ¶
type FollowRequest struct { ID int64 `json:"id" db:"id"` ActorID string `json:"actor_id" db:"actor_id"` FollowsID string `json:"follows_id" db:"follows_id"` }
Member holds the core information about a member
type Follower ¶
type Follower struct { ID uint32 `json:"id" db:"id"` Follower uint32 `json:"follower" db:"follower"` Followee uint32 `json:"followee" db:"followee"` }
Follower represents a follower-followee relationship
type Input ¶
type Input struct { MemberName string `json:"membername"` Email string `json:"email"` Password string `json:"password"` }
Input holds the information required to create a new member account
type Member ¶
type Member struct { ID uint32 `json:"id" db:"id"` UUID string `json:"_key,omitempty" db:"uuid"` PassHash string `json:"passhash" db:"passhash"` MemberName string `json:"memberName" db:"nick"` // i.e. @nick@instance DisplayName sql.NullString `json:"displayName,omitempty" db:"display_name"` Email string `json:"email" db:"email" validate:"required,email"` Bio sql.NullString `json:"bio,omitempty" db:"bio"` Active bool `json:"active" db:"active"` Roles []uint8 `json:"roles,omitempty" db:"roles"` RegTimestamp time.Time `json:"regdate" db:"reg_timestamp"` ProfilePic *static.Image `json:"profilepic,omitempty" db:"profilepic_id"` Homepage sql.NullString `json:"homepage,omitempty" db:"homepage"` IRC sql.NullString `json:"irc,omitempty" db:"irc"` XMPP sql.NullString `json:"xmpp,omitempty" db:"xmpp"` Matrix sql.NullString `json:"matrix,omitempty" db:"matrix"` Visibility string `json:"visibility" db:"visibility"` Followers activitypub.Collection `json:"followers,omitempty" db:"followers"` }
Member holds the core information about a member
type MemberStorer ¶
type MemberStorer interface { Save(ctx context.Context, member *Member) error Read(ctx context.Context, keyName, key string) (*Member, error) Update(ctx context.Context, member *Member) error Delete(ctx context.Context, member *Member) error GetID(ctx context.Context, key string) (uint32, error) GetPassHash(email, login string) (string, error) CreateSession(ctx context.Context, member *Member) (string, error) RequestFollow(ctx context.Context, fr *FollowRequest) error }
Member holds the core information about a member
type Neo4jMemberStorage ¶
type Neo4jMemberStorage struct {
// contains filtered or unexported fields
}
Member holds the core information about a member
func NewNeo4jStorage ¶
func NewNeo4jStorage(client neo4j.DriverWithContext, log *zerolog.Logger, conf *cfg.Config) Neo4jMemberStorage
func (Neo4jMemberStorage) Close ¶
func (s Neo4jMemberStorage) Close() error
func (Neo4jMemberStorage) CreateSession ¶
func (Neo4jMemberStorage) Delete ¶
func (s Neo4jMemberStorage) Delete(ctx context.Context, member *Member) error
func (Neo4jMemberStorage) GetPassHash ¶
func (s Neo4jMemberStorage) GetPassHash(email, login string) (string, error)
func (Neo4jMemberStorage) RequestFollow ¶
func (s Neo4jMemberStorage) RequestFollow(ctx context.Context, fr *FollowRequest) error
type PgMemberStorage ¶
type PgMemberStorage struct {
// contains filtered or unexported fields
}
Member holds the core information about a member
func NewSQLStorage ¶
func (*PgMemberStorage) CacheNicknames ¶
func (s *PgMemberStorage) CacheNicknames(ctx context.Context) error
func (*PgMemberStorage) CreateSession ¶
CreateSession creates a JWT token for the member
func (*PgMemberStorage) Delete ¶
func (s *PgMemberStorage) Delete(ctx context.Context, member *Member) error
func (*PgMemberStorage) GetID ¶
GetID retrieves the ID required for JWT on the basis of one of the credentials, i.e. email or login
func (*PgMemberStorage) GetNicknames ¶
func (s *PgMemberStorage) GetNicknames() []string
func (*PgMemberStorage) GetPassHash ¶
func (s *PgMemberStorage) GetPassHash(email, login string) (string, error)
GetPassHash retrieves the password hash required for JWT on the basis of one of the credentials, i.e. email or login
func (*PgMemberStorage) RequestFollow ¶
func (s *PgMemberStorage) RequestFollow(ctx context.Context, fr *FollowRequest) error
RequestFollow creates a follow request in the local database upon the reception of a request into the inbox