db

package
v0.0.0-...-e11f1d1 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

Create new database connection to the configured database configuration.

Types

type CassandraDB

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

func NewCassandraDB

func NewCassandraDB(hosts []string, dbname string, timeout time.Duration) (
	*CassandraDB, error)

Create a new connection to the membership database on the given "host". Will set the keyspace to "dbname".

func (*CassandraDB) EnumerateDeQueuedMembers

func (m *CassandraDB) EnumerateDeQueuedMembers(
	ctx context.Context, prev string, num int32) ([]*membersys.MemberWithKey,
	error)

Get a list of all former members which are currently in the departing members queue.

func (*CassandraDB) EnumerateMembers

func (m *CassandraDB) EnumerateMembers(
	ctx context.Context, prev string, num int32) ([]*membersys.Member,
	error)

Get a list of all members currently in the database. Returns a set of "num" entries beginning after "prev". Returns a filled-out member structure.

func (*CassandraDB) EnumerateMembershipRequests

func (m *CassandraDB) EnumerateMembershipRequests(
	ctx context.Context, criterion, prev string, num int32) (
	[]*membersys.MembershipAgreementWithKey, error)

Get a list of all membership applications currently in the database. Returns a set of "num" entries beginning after "prev". If "criterion" is given, it will be compared against the name of the member.

func (*CassandraDB) EnumerateQueuedMembers

func (m *CassandraDB) EnumerateQueuedMembers(
	ctx context.Context, prev string, num int32) ([]*membersys.MemberWithKey,
	error)

Get a list of all future members which are currently in the queue.

func (*CassandraDB) EnumerateTrashedMembers

func (m *CassandraDB) EnumerateTrashedMembers(
	ctx context.Context, prev string, num int32) ([]*membersys.MemberWithKey,
	error)

Get a list of all members which are currently in the trash.

func (*CassandraDB) GetMemberDetail

func (m *CassandraDB) GetMemberDetail(ctx context.Context, id string) (
	*membersys.MembershipAgreement, error)

Retrieve a specific members detailed membership data.

func (*CassandraDB) GetMemberDetailByUsername

func (m *CassandraDB) GetMemberDetailByUsername(
	ctx context.Context, username string) (
	*membersys.MembershipAgreement, error)

Retrieve a specific members detailed membership data, but fetch it by the user name of the member.

func (*CassandraDB) GetMembershipRequest

func (m *CassandraDB) GetMembershipRequest(ctx context.Context, id string) (
	*membersys.MembershipAgreement, error)

Retrieve an individual applicants data.

func (*CassandraDB) MoveApplicantToNewMember

func (m *CassandraDB) MoveApplicantToNewMember(
	ctx context.Context, id, initiator string) error

Move the record of the given applicant to the queue of new users to be processed. The approver will be set to "initiator".

func (*CassandraDB) MoveApplicantToTrash

func (m *CassandraDB) MoveApplicantToTrash(
	ctx context.Context, id, initiator string) error

Move the record of the given applicant to a temporary archive of deleted applications. The deleter will be set to "initiator".

func (*CassandraDB) MoveDeletedMemberToArchive

func (m *CassandraDB) MoveDeletedMemberToArchive(
	ctx context.Context, member *membersys.MemberWithKey) error

Move the record of the given dequeued member from the queue of deleted users to the list of archived members. Set the retention to 2 years instead of just 6 months, since they have been a member. This method is to be used by the account deletion software.

func (*CassandraDB) MoveMemberToTrash

func (m *CassandraDB) MoveMemberToTrash(
	ctx context.Context, id, initiator, reason string) error

Move a member record to the queue for getting their user account removed (e.g. when they leave us).

func (*CassandraDB) MoveNewMemberToFullMember

func (m *CassandraDB) MoveNewMemberToFullMember(
	ctx context.Context, member *membersys.MemberWithKey) error

Move the record of the given queued member from the queue of new users to the list of active users. This method is to be used by the account creation software.

func (*CassandraDB) MoveQueuedRecordToTrash

func (m *CassandraDB) MoveQueuedRecordToTrash(
	ctx context.Context, id, initiator string) error

Move a member from the queue to the trash (e.g. if they can't be processed).

func (*CassandraDB) SetBoolValue

func (m *CassandraDB) SetBoolValue(
	ctx context.Context, id string, field string, value bool) error

Update the specified boolean field for the given member.

func (*CassandraDB) SetLongValue

func (m *CassandraDB) SetLongValue(
	ctx context.Context, id string, field string, value uint64) error

Update the specified long field for the given member.

func (*CassandraDB) SetMemberFee

func (m *CassandraDB) SetMemberFee(
	ctx context.Context, id string, fee uint64, yearly bool) error

Update the membership fee for the given member.

func (*CassandraDB) SetTextValue

func (m *CassandraDB) SetTextValue(
	ctx context.Context, id string, field, value string) error

Update the specified text column on the membership data.

func (*CassandraDB) StoreMembershipAgreement

func (m *CassandraDB) StoreMembershipAgreement(
	ctx context.Context, id string, agreement_data []byte) error

Add the membership agreement form scan to the given membership request record.

func (*CassandraDB) StoreMembershipRequest

func (m *CassandraDB) StoreMembershipRequest(
	ctx context.Context, req *membersys.FormInputData) (
	key string, err error)

Store the given membership request in the database.

func (*CassandraDB) StreamingEnumerateDeQueuedMembers

func (m *CassandraDB) StreamingEnumerateDeQueuedMembers(
	ctx context.Context, prev string, num int32,
	queued chan<- *membersys.MemberWithKey, errors chan<- error)

Get a list of all former members which are currently in the departing members queue.

func (*CassandraDB) StreamingEnumerateMembers

func (m *CassandraDB) StreamingEnumerateMembers(
	ctx context.Context, prev string, num int32,
	members chan<- *membersys.Member, errors chan<- error)

Streams a list of all members currently in the database to the channel specified. Returns a set of "num" entries beginning after "prev". Returns a filled-out member structure.

func (*CassandraDB) StreamingEnumerateMembershipRequests

func (m *CassandraDB) StreamingEnumerateMembershipRequests(
	ctx context.Context, criterion, prev string, num int32,
	agreementStream chan<- *membersys.MembershipAgreementWithKey,
	errorStream chan<- error)

func (*CassandraDB) StreamingEnumerateQueuedMembers

func (m *CassandraDB) StreamingEnumerateQueuedMembers(
	ctx context.Context, prev string, num int32,
	queued chan<- *membersys.MemberWithKey, errors chan<- error)

Get a list of all future members which are currently in the queue.

func (*CassandraDB) StreamingEnumerateTrashedMembers

func (m *CassandraDB) StreamingEnumerateTrashedMembers(
	ctx context.Context, prev string, num int32,
	queued chan<- *membersys.MemberWithKey, errors chan<- error)

Get a list of all members which are currently in the trash.

type PostgreSQLDB

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

Implementation of a PostgreSQL client.

func NewPostgreSQLDB

func NewPostgreSQLDB(host, dbname, user, password string, ssl bool) (
	*PostgreSQLDB, error)

Establish new PostgreSQL database connection.

func (*PostgreSQLDB) EnumerateDeQueuedMembers

func (p *PostgreSQLDB) EnumerateDeQueuedMembers(
	ctx context.Context, prev string, num int32) ([]*membersys.MemberWithKey,
	error)

Get a list of all former members which are currently in the departing members queue.

func (*PostgreSQLDB) EnumerateMembers

func (p *PostgreSQLDB) EnumerateMembers(
	ctx context.Context, prev string, num int32) ([]*membersys.Member,
	error)

Get a list of all members currently in the database. Returns a set of "num" entries beginning after "prev". Returns a filled-out member structure.

func (*PostgreSQLDB) EnumerateMembershipRequests

func (p *PostgreSQLDB) EnumerateMembershipRequests(
	ctx context.Context, criterion, prev string, num int32) (
	[]*membersys.MembershipAgreementWithKey, error)

Get a list of all membership applications currently in the database. Returns a set of "num" entries beginning after "prev". If "criterion" is given, it will be compared against the name of the member.

func (*PostgreSQLDB) EnumerateQueuedMembers

func (p *PostgreSQLDB) EnumerateQueuedMembers(
	ctx context.Context, prev string, num int32) ([]*membersys.MemberWithKey,
	error)

Get a list of all future members which are currently in the queue.

func (*PostgreSQLDB) EnumerateTrashedMembers

func (p *PostgreSQLDB) EnumerateTrashedMembers(
	ctx context.Context, prev string, num int32) ([]*membersys.MemberWithKey,
	error)

Get a list of all members which are currently in the trash.

func (*PostgreSQLDB) GetMemberDetail

func (p *PostgreSQLDB) GetMemberDetail(
	ctx context.Context, id string) (
	*membersys.MembershipAgreement, error)

Retrieve a specific members defailed membership data, but fetch it by the user name of the member.

func (*PostgreSQLDB) GetMemberDetailByUsername

func (p *PostgreSQLDB) GetMemberDetailByUsername(
	ctx context.Context, username string) (
	*membersys.MembershipAgreement, error)

Retrieve a specific members defailed membership data, but fetch it by the user name of the member.

func (*PostgreSQLDB) GetMembershipRequest

func (p *PostgreSQLDB) GetMembershipRequest(ctx context.Context, id string) (
	*membersys.MembershipAgreement, error)

Retrieve an individual applicants data.

func (*PostgreSQLDB) MoveApplicantToNewMember

func (p *PostgreSQLDB) MoveApplicantToNewMember(
	ctx context.Context, id, initiator string) error

Move the record of the given applicant to the queue of new users to be processed. The approver will be set to "initiator".

func (*PostgreSQLDB) MoveApplicantToTrash

func (p *PostgreSQLDB) MoveApplicantToTrash(
	ctx context.Context, id, initiator string) error

Move the record of the given applicant to a temporary archive of deleted applications. The deleter will be set to "initiator".

func (*PostgreSQLDB) MoveDeletedMemberToArchive

func (p *PostgreSQLDB) MoveDeletedMemberToArchive(
	ctx context.Context, member *membersys.MemberWithKey) error

Move the record of the given dequeued member from the queue of deleted users to the list of archived members. Set the retention to 2 years instead of just 6 months, since they have been a member. This method is to be used by the account deletion software.

func (*PostgreSQLDB) MoveMemberToTrash

func (p *PostgreSQLDB) MoveMemberToTrash(
	ctx context.Context, id, initiator, reason string) error

Move a member record to the queue for getting their user account removed (e.g. when they leave us).

func (*PostgreSQLDB) MoveNewMemberToFullMember

func (p *PostgreSQLDB) MoveNewMemberToFullMember(
	ctx context.Context, member *membersys.MemberWithKey) error

Move the record of the given queued member from the queue of new users to the list of active users. This method is to be used by the account creation software.

func (*PostgreSQLDB) MoveQueuedRecordToTrash

func (p *PostgreSQLDB) MoveQueuedRecordToTrash(
	ctx context.Context, id, initiator string) error

Move a member from the queue to the trash (e.g. if they can't be processed).

func (*PostgreSQLDB) SetBoolValue

func (p *PostgreSQLDB) SetBoolValue(
	ctx context.Context, id string, field string, value bool) error

Update the specified boolean field for the given member.

func (*PostgreSQLDB) SetLongValue

func (p *PostgreSQLDB) SetLongValue(
	ctx context.Context, id string, field string, value uint64) error

Update the specified long field for the given member.

func (*PostgreSQLDB) SetMemberFee

func (p *PostgreSQLDB) SetMemberFee(
	ctx context.Context, id string, fee uint64, yearly bool) error

Update the membership fee for the given member.

func (*PostgreSQLDB) SetTextValue

func (p *PostgreSQLDB) SetTextValue(
	ctx context.Context, id string, field, value string) error

Update the specified text field for the given member.

func (*PostgreSQLDB) StoreMembershipAgreement

func (p *PostgreSQLDB) StoreMembershipAgreement(
	ctx context.Context, id string, agreement_data []byte) error

Add the membership agreement form scan to the given membership request record.

func (*PostgreSQLDB) StoreMembershipRequest

func (p *PostgreSQLDB) StoreMembershipRequest(
	ctx context.Context, req *membersys.FormInputData) (string, error)

Store the given membership request in the database.

func (*PostgreSQLDB) StreamingEnumerateDeQueuedMembers

func (p *PostgreSQLDB) StreamingEnumerateDeQueuedMembers(
	ctx context.Context, prev string, num int32,
	queued chan<- *membersys.MemberWithKey, errors chan<- error)

func (*PostgreSQLDB) StreamingEnumerateMembers

func (p *PostgreSQLDB) StreamingEnumerateMembers(
	ctx context.Context, prev string, num int32,
	members chan<- *membersys.Member, errors chan<- error)

func (*PostgreSQLDB) StreamingEnumerateMembershipRequests

func (p *PostgreSQLDB) StreamingEnumerateMembershipRequests(
	ctx context.Context, criterion, prev string, num int32,
	agreementsWithKey chan<- *membersys.MembershipAgreementWithKey,
	errors chan<- error)

func (*PostgreSQLDB) StreamingEnumerateQueuedMembers

func (p *PostgreSQLDB) StreamingEnumerateQueuedMembers(
	ctx context.Context, prev string, num int32,
	queued chan<- *membersys.MemberWithKey, errors chan<- error)

func (*PostgreSQLDB) StreamingEnumerateTrashedMembers

func (p *PostgreSQLDB) StreamingEnumerateTrashedMembers(
	ctx context.Context, prev string, num int32,
	queued chan<- *membersys.MemberWithKey, errors chan<- error)

Jump to

Keyboard shortcuts

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