Documentation ¶
Overview ¶
Package db implements an abstraction for the database.
String List ¶
Some functions have a space-delimited (%x20) list as an argument. It is expected to be compatible with similar lists used in RFC 6749.
RFC 6749 - The OAuth 2.0 Authorization Framework https://tools.ietf.org/html/rfc6749
Index ¶
- Constants
- Variables
- type Attendance
- type Club
- type ClubCommon
- type ClubEntry
- type ClubEntryChan
- type ClubEntryCommon
- type ClubMemberChan
- type ClubMemberResult
- type DB
- func (db DB) Authenticate(id, password string) error
- func (db DB) Close() error
- func (db DB) ConfirmMember(id string) error
- func (db DB) DeclareMemberOB(id string) error
- func (db DB) DeleteClub(id string) error
- func (db DB) DeleteMail(subject string) error
- func (db DB) DeleteMember(id string) error
- func (db DB) DeleteOfficer(operator, id string) error
- func (db DB) DeleteParty(name, creator string) error
- func (db DB) GetScope(id string, password string) (scope.Scope, error)
- func (db DB) InsertClub(id, name, chief string) error
- func (db DB) InsertMail(recipients, from, to, subject, body string) (returnedFrom string, returnedMails []string, returnedErr error)
- func (db DB) InsertMember(id, mail, nickname string) error
- func (db DB) InsertOfficer(id, name, member, scope string) error
- func (db DB) InsertParty(name, creator string, start, end encoding.Time, place string, ...) ([]string, error)
- func (db DB) QueryClub(id string) (Club, error)
- func (db DB) QueryClubName(id string) (string, error)
- func (db DB) QueryClubs() (ClubEntryChan, error)
- func (db DB) QueryMail(subject string) (MailDetail, error)
- func (db DB) QueryMails() MailEntryChan
- func (db DB) QueryMemberDetail(id string) (MemberDetail, error)
- func (db DB) QueryMemberGraph(id string) (MemberGraph, error)
- func (db DB) QueryMemberMails() MemberMailChan
- func (db DB) QueryMemberNickname(id string) (string, error)
- func (db DB) QueryMemberTmp(id string) (bool, error)
- func (db DB) QueryMembers() MemberEntryChan
- func (db DB) QueryMembersCount(entrance int, nickname string, realname string, status MemberStatus) (uint16, error)
- func (db DB) QueryOfficerDetail(id string) (OfficerDetail, error)
- func (db DB) QueryOfficerName(id string) (string, error)
- func (db DB) QueryOfficerNames() OfficerNameChan
- func (db DB) QueryOfficers() OfficerEntryChan
- func (db DB) QueryParties(user string) PartyUserChan
- func (db DB) QueryParty(name string) (PartyDetail, error)
- func (db DB) UpdateAttendance(attending bool, party, member string) error
- func (db DB) UpdateClub(id, name, chief string) error
- func (db DB) UpdateMail(subject, recipients string, date encoding.Time, from, to, body string) error
- func (db DB) UpdateMember(id string, confirm, ob bool, password, affiliation, clubs string, entrance int, ...) error
- func (db DB) UpdateOfficer(operator, id, name, member, scope string) error
- func (db DB) UpdateParty(name, creator string, start, end encoding.Time, place string, ...) error
- func (db DB) UpdatePassword(id, currentPassword, newPassword string) error
- type MailCommon
- type MailDetail
- type MailEntry
- type MailEntryChan
- type MailEntryResult
- type MemberClub
- type MemberClubChan
- type MemberClubQuerier
- type MemberClubResult
- type MemberCommon
- type MemberDetail
- type MemberEntry
- type MemberEntryChan
- type MemberEntryResult
- type MemberGraph
- type MemberMailChan
- type MemberMailResult
- type MemberStatus
- type OfficerDetail
- type OfficerEntry
- type OfficerEntryChan
- type OfficerEntryResult
- type OfficerName
- type OfficerNameChan
- type OfficerNameResult
- type PartyAttendanceChan
- type PartyAttendanceResult
- type PartyCommon
- type PartyDetail
- type PartyEntry
- type PartyNameChan
- type PartyNameResult
- type PartyUser
- type PartyUserChan
- type PartyUserResult
- type PositionChan
- type PositionQuerier
- type PositionResult
- type RecipientChan
- type RecipientResult
Constants ¶
const NoScopeUpdate = "\000"
NoScopeUpdate is a string telling not to upate the scope.
Variables ¶
var ErrBadOmission = errors.New(`bad omission`)
ErrBadOmision is an error telling omitting parameters is forbidden.
var ErrDupEntry = errors.New(`duplicate entry`)
ErrDupEntry is an error telling the entry is duplicate.
var ErrIncorrectIdentity = errors.New(`incorrect identity`)
ErrIncorrectIdentity is an error telling the identity is incorrect.
var ErrInvalid = errors.New(`invalid`)
ErrInvalid is an error telling some of the given parameter is invalid.
var ErrMemberIsOfficer = errors.New(`member is officer`)
ErrMemberIsOfficer is an error telling the member is an officer, which is unexpected.
var ErrOfficerSuicide = errors.New(`removing operator's own management permission`)
ErrOfficerSuicide is an error telling the operator is removing his own management permission.
Functions ¶
This section is empty.
Types ¶
type Attendance ¶
type Attendance uint16
Attendance is a type representing an attendance.
const ( AttendanceUninvited Attendance = iota AttendanceInvited AttendanceDeclined AttendanceAccepted )
The values Attendance may have.
func (Attendance) MarshalJSON ¶
func (attendance Attendance) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the attendance.
This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
type Club ¶
type Club struct { ClubCommon Members ClubMemberChan `json:"members"` }
Club is a structure holding the information about a club.
type ClubCommon ¶
type ClubEntry ¶
type ClubEntry struct { ClubEntryCommon Members []string `json:"members"` }
type ClubEntryChan ¶
type ClubEntryChan <-chan ClubEntry
ClubEntryChan is a reciever of db.ClubEntry.
func (ClubEntryChan) MarshalJSON ¶
func (entryChan ClubEntryChan) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the remaining entries and closes the channel.
This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
type ClubEntryCommon ¶
type ClubEntryCommon struct { ClubCommon ID string `json:"id"` }
type ClubMemberChan ¶
type ClubMemberChan <-chan ClubMemberResult
ClubMemberChan is a reciever of db.ClubMemberResult.
func (ClubMemberChan) MarshalJSON ¶
func (memberChan ClubMemberChan) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the members and closes the channel. This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
type ClubMemberResult ¶
ClubMemberResult is a structure holding a result of querying the members belonging to a club.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a structure holding the connection to the database. It should be initialized with db.New.
func (DB) Authenticate ¶
func (DB) Close ¶
Close closes the connection to the database. It must be called before disposing db.DB returned by db.New.
func (DB) ConfirmMember ¶
ConfirmMember confirms the email address of the member identified by the given ID.
It returns db.ErrIncorrectIdentity if the ID is incorrect. Other errors tell db.DB is bad.
func (DB) DeclareMemberOB ¶
DeclareMemberOB declares the memeber identified by the given ID is now an OB.
It returns db.ErrIncorrectIdentity if the ID is incorrect. Other errors tell db.DB is bad.
func (DB) DeleteClub ¶
DeleteClub deletes a club identified by the given ID.
It returns db.ErrIncorrectIdentity if the given ID is incorrect. Other errors tell db.DB is bad.
func (DB) DeleteMail ¶
DeleteMail delets the email with the given subject.
It returns db.ErrIncorrectIdentity if the given subject is incorrect. Other errors tell db.DB is bad.
func (DB) DeleteMember ¶
DeleteMember deletes the member identified by the given ID.
It returns db.ErrMemberIsOfficer if the member is an officer. It returns db.ErrIncorrectIdentity if the ID is incorrect. Other errors tell db.DB is bad.
func (DB) DeleteOfficer ¶
DeleteOfficer deletes an officer identified by the given ID.
It returns db.ErrIncorrectIdentity if the given ID of the operator or the officer is incorrect. It returns db.ErrOfficerSuicide if the operation is expected to remove the management permission of the operator. Other errors tell db.DB is bad.
func (DB) DeleteParty ¶
DeleteParty deletes a party.
It returns db.ErrIncorrectIdentity if any party named with the given name and created by the member identified by the given ID does not exist. Other errors tell db.DB is bad.
func (DB) GetScope ¶
GetScope returns the scope of the member identified with the given credentials.
It returns db.ErrIncorrectIdentity if the credentials are incorrect. Other errors tell db.DB is bad.
func (DB) InsertClub ¶
InsertClub inserts a club with the given properties.
It may return one of the following errors: db.ErrBadOmission tells the ID or name is omitted. db.ErrDupEntry tells a club with the given ID already exists. db.ErrIncorrectIdentity tells the ID of the chief is incorrect. db.ErrInvalid tells some of the given properties is invalid.
Other errors tell db.DB is bad.
func (DB) InsertMail ¶
func (db DB) InsertMail(recipients, from, to, subject, body string) (returnedFrom string, returnedMails []string, returnedErr error)
InsertMail inserts an email with the given properties and returns the nickname of From and the IDs of the recipients.
It may return one of the following errors: db.ErrBadOmission tells recipients, to, subject, or body is omitted. db.ErrDupEntry tells the subject is duplicate. db.ErrIncorrectIdentity tells one of the IDs of the recipients or the one of From is incorrect. db.ErrInvalid tells one of the given properties is invalid.
Other errors tell db.DB is bad.
func (DB) InsertMember ¶
InsertMember inserts a member with the given properties.
It may return one of the following errors: db.ErrBadOmission tells the ID, email address, or nickname is omitted. db.ErrDupEntry tells the ID is duplicate. db.ErrInvalid tells some of the properties is invalid.
Other errors tell db.DB is bad.
func (DB) InsertOfficer ¶
InsertOfficer inserts an operator with the given properties.
It may return one of the following errors: db.ErrBadOmission tells the ID or name is omitted. db.ErrDupEntry tells the ID or name is duplicate. db.ErrIncorrectIdentity tells the ID of the member is incorrect. db.ErrInvalid tells the name of the scope is invalid.
Other errors tell db.DB is bad.
func (DB) InsertParty ¶
func (db DB) InsertParty(name, creator string, start, end encoding.Time, place string, due encoding.Time, invitedIDs, inviteds, details string) ([]string, error)
InsertParty inserts a party with the given properties and returns the email addresses of the invited members.
It may return one of the following errors: db.ErrBadOmission tells some of the parameters is omitted. db.ErrDupEntry tells the name is duplicate. db.ErrIncorrectIdentity tells the ID of the creator or one of the invited members is incorrect. db.ErrInvalid tells some of the properties is invalid.
func (DB) QueryClub ¶
QueryClub returns db.Club corresponding with the given ID.
It returns db.ErrIncorrectIdentity if the given ID is incorrect. Other errors tell db.DB is bad.
Resources will be holded until Members gets closed.
func (DB) QueryClubName ¶
QueryClubName returns the name of the club identified with the given ID.
It returns db.ErrIncorrectIdentity if the given ID is incorrect. Other errors tell db.DB is bad.
func (DB) QueryClubs ¶
func (db DB) QueryClubs() (ClubEntryChan, error)
QueryClubs returns db.ClubChan which represents all the clubs.
A result recieved from the returned channel tells an error if db.DB is bad.
Resources will be holded until the channel gets closed.
func (DB) QueryMail ¶
func (db DB) QueryMail(subject string) (MailDetail, error)
QueryMail returns db.MailDetail describing the email with the given subject.
It returns db.ErrIncorrectIdentity if the given subject is incorrect. Other errors tell db.DB is bad.
Resources will be holded until Recipients gets closed.
func (DB) QueryMails ¶
func (db DB) QueryMails() MailEntryChan
QueryMails returns a channel sending db.MailEntryResult of all mails.
db.MailEntryResult will have an error if db.DB is bad.
Resources will be holded until the channel gets closed.
func (DB) QueryMemberDetail ¶
func (db DB) QueryMemberDetail(id string) (MemberDetail, error)
QueryMemberDetail returns db.MemberDetail of the member identified with the given ID.
It returns db.ErrIncorrectIdentity if the ID is incorrect. Other errors tell db.DB is bad.
tl;dr: If you need Query of Clubs and/or Positions, use them and call End as soon as possible! For channels returned by them: use them and drain atomically!
Long explanation: Any other transactions will be blocked until End function of db.MemberDetail gets called. Clubs and Positions of db.MemberDetail will be invalid after that. Channels returned by Query or MarshalJSON of Clubs and Positions will block each other. For example, if you call Query of Clubs while a channel returned by another Query is left open, it will result in dead blocking.
func (DB) QueryMemberGraph ¶
func (db DB) QueryMemberGraph(id string) (MemberGraph, error)
QueryMemberGraph returns db.MemberGraph of the member identified with the given ID.
It returns db.ErrIncorrectIdentity if the given ID is incorrect. Other errors tell db.DB is bad.
func (DB) QueryMemberMails ¶
func (db DB) QueryMemberMails() MemberMailChan
QueryMemberMails returns db.MemberMailChan representing the email addresses of all members.
Resources will be holded until the channel gets closed.
func (DB) QueryMemberNickname ¶
QueryMemberNickname returns the nickname of the member identified by the given ID.
It returns ErrIncorrectIdentity if the ID is incorrect. Other errors tell db.DB is bad.
func (DB) QueryMemberTmp ¶
QueryMemberTmp returns a Boolean telling whether the member identified by the given ID has not completed his registration.
It returns db.ErrIncorrectIdentity if the ID is incorrect. Other errors tell db.DB is bad.
func (DB) QueryMembers ¶
func (db DB) QueryMembers() MemberEntryChan
QueryMembers returns db.MemberEntryChan which represents all members.
Resources will be holded until the channel gets closed.
func (DB) QueryMembersCount ¶
func (db DB) QueryMembersCount(entrance int, nickname string, realname string, status MemberStatus) (uint16, error)
QueryMembersCount returns the number of the members who matches the given conditions.
It returns db.ErrInvalid if the given status is invalid. Other errors tell db.DB is bad.
func (DB) QueryOfficerDetail ¶
func (db DB) QueryOfficerDetail(id string) (OfficerDetail, error)
QueryOfficerDetail returns db.OfficerDetail of the officer identified with the given ID.
It returns db.ErrIncorrectIdentity if the given ID is incorrect. Other errors tell db.DB is bad.
func (DB) QueryOfficerName ¶
QueryOfficerName returns the name of the officer identified with the given ID.
It returns db.ErrIncorrectIdentity if the given ID is incorrect. Other errors tell db.DB is bad.
func (DB) QueryOfficerNames ¶
func (db DB) QueryOfficerNames() OfficerNameChan
QueryOfficerNames returns db.OfficerNameChan representing the names of all officers.
Resources will be holded until the channel gets closed.
func (DB) QueryOfficers ¶
func (db DB) QueryOfficers() OfficerEntryChan
QueryOfficers returns db.OfficerEntryChan which represents all the officers.
Resources will be holded until the channel gets closed.
func (DB) QueryParties ¶
func (db DB) QueryParties(user string) PartyUserChan
QueryParties returns db.PartyUserChan representing all parties.
Resources will be holded until the channel gets closed.
func (DB) QueryParty ¶
func (db DB) QueryParty(name string) (PartyDetail, error)
QueryParty queries details of a party identified by the given name.
It returns db.ErrIncorrectIdentity if the name is incorrect.
Resources will be holded until Attendances gets closed.
func (DB) UpdateAttendance ¶
UpdateAttendance updates attendance of a member identified by the given ID for the party identified by the given name.
It returns ErrIncorrectIdentity if the given ID or name is incorrect. Other errors tell db.DB is bad.
func (DB) UpdateClub ¶
UpdateClub updates the club identified with the given ID, with the given properties.
It may return one of the following errors: db.ErrIncorrectIdentity tells the given ID of the club or the one of the chief is incorrect. db.ErrInvalid tells some of the given properties is invalid.
Other errors tell db.DB is bad.
func (DB) UpdateMail ¶
func (db DB) UpdateMail(subject, recipients string, date encoding.Time, from, to, body string) error
UpdateMail updates the email with the given subject, with the given properties.
It may return one of the following errors: db.ErrIncorrectIdentity tells the IDs of the recipients or from is incorrect. db.ErrInvalid tells some of the given properties is invalid.
Other errors tell db.DB is bad.
func (DB) UpdateMember ¶
func (db DB) UpdateMember(id string, confirm, ob bool, password, affiliation, clubs string, entrance int, gender, mail, nickname, realname, tel string) error
UpdateMember updates a member identified with the given ID, with the given properties.
It returns db.ErrIncorrectIdentity if the ID is incorrect. It returns db.ErrInvalid if some of the properties is invalid. Other errors tell db.DB is bad.
func (DB) UpdateOfficer ¶
UpdateOfficer updates the officer identified by the given ID, with the given properties.
It may return one of the following properties: db.ErrDupEntry tells the name is duplicate. db.ErrIncorrectIdentity tells the ID of the officer or member is incorrect. db.ErrInvalid tells some of the properties is invalid.
Other errors tell db.DB is bad.
func (DB) UpdateParty ¶
func (db DB) UpdateParty(name, creator string, start, end encoding.Time, place string, due encoding.Time, inviteds, invitedIDs, details string) error
UpdateParty updates the party identified by the given name and created by the member identified by the given ID, with the given properties.
It may return one of the following errors: ErrIncorrectIdentity tells the name of the party or the ID of the creator or one of the invited members is incorrect. ErrInvalid tells some of the properties is invalid.
Other errors tell db.DB is bad.
func (DB) UpdatePassword ¶
UpdatePassword updates.the password of the member identified by the given ID.
It returns db.ErrIncorrectIdentity if the ID or the given current password is incorrect. It returns db.ErrInvalid if the given new password is invalid. Other errors tell db.DB is bad.
type MailCommon ¶
type MailCommon struct { Date encoding.Time `json:"date"` From encoding.ZeroString `json:"from"` To string `json:"to"` }
MailCommon is a structure holding information about a email common for some queries.
type MailDetail ¶
type MailDetail struct { MailCommon Recipients RecipientChan `json:"recipients"` Body string `json:"body"` }
MailDetail is a structure holding details about a email.
type MailEntry ¶
type MailEntry struct { MailCommon Subject string `json:"subject"` }
MailEntry is a structure holding basic information about a email.
type MailEntryChan ¶
type MailEntryChan <-chan MailEntryResult
MailEntryChan is a reciever of db.MailEntryResult.
func (MailEntryChan) MarshalJSON ¶
func (entryChan MailEntryChan) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the remaining entries and closes the channel. This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
type MailEntryResult ¶
MailEntryResult is a structure representing a result of querying db.MailEntry.
type MemberClub ¶
MemberClub is a structure holding the information about a club which a member belongs to.
type MemberClubChan ¶
type MemberClubChan <-chan MemberClubResult
MemberClubChan is a reciever of MemberClubResult.
func (MemberClubChan) MarshalJSON ¶
func (clubChan MemberClubChan) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the remaining clubs a member belonging and closes the channel.
This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
type MemberClubQuerier ¶
type MemberClubQuerier struct {
// contains filtered or unexported fields
}
MemberClubQuerier is a structure to provide a feature to query db.MemberClub.
func (MemberClubQuerier) MarshalJSON ¶
func (querier MemberClubQuerier) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the clubs of a member.
This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
func (MemberClubQuerier) Query ¶
func (querier MemberClubQuerier) Query() MemberClubChan
Query returns db.MemberClubChan representing the clubs a member belonging to.
It will blocks any other operations sharing the context or the database until the channel gets closed.
type MemberClubResult ¶
type MemberClubResult struct { MemberClub Error error }
MemberClubResult is a structure representing a result of querying db.MemberClub.
type MemberCommon ¶
type MemberCommon struct { Affiliation encoding.ZeroString `json:"affiliation"` Entrance encoding.ZeroUint16 `json:"entrance"` Nickname string `json:"nickname"` OB bool `json:"ob"` Realname encoding.ZeroString `json:"realname"` }
MemberCommon is a structure holding information about a member common for queries.
type MemberDetail ¶
type MemberDetail struct { MemberCommon Clubs MemberClubQuerier `json:"clubs"` Confirmed bool `json:"confirmed"` Gender encoding.ZeroString `json:"gender"` Mail string `json:"mail"` Positions PositionQuerier `json:"positions"` Tel encoding.ZeroString `json:"tel"` }
MemberDetail is a structure holding details of a member.
func (MemberDetail) End ¶
func (detail MemberDetail) End() error
End ends the transaction and releases all resources.
type MemberEntry ¶
type MemberEntry struct { MemberCommon ID string `json:"id"` }
MemberEntry is a structure holding the basic information of a member.
type MemberEntryChan ¶
type MemberEntryChan <-chan MemberEntryResult
MemberEntryChan is a reciever of db.MemberEntryResult.
func (MemberEntryChan) MarshalJSON ¶
func (entryChan MemberEntryChan) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the remaining entries and closes the channel.
This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
type MemberEntryResult ¶
type MemberEntryResult struct { MemberEntry Error error }
MemberEntryResult is a structure representing a result of querying db.MemberEntry.
type MemberGraph ¶
MemberGraph is a structure holding the information about a member to render a graph.
type MemberMailChan ¶
type MemberMailChan <-chan MemberMailResult
MemberMailChan is a reciever of db.MemberMailResult.
func (MemberMailChan) MarshalJSON ¶
func (mailChan MemberMailChan) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the remaining pairs of ID and email address, and closes the channel.
This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
type MemberMailResult ¶
MemberMailResult is a structure representing a result of querying the ID and email address of a member.
type MemberStatus ¶
type MemberStatus uint
MemberStatus is an unsigned integer which describes the acceptable status of members for querying.
const ( MemberStatusOB MemberStatus = 1 << iota MemberStatusActive MemberStatus = 1 << iota )
These are flags for MemberStatus.
type OfficerDetail ¶
type OfficerDetail struct { Member string `json:"member"` Name string `json:"name"` Scope []string `json:"scope"` }
OfficerDetail is a structure holding details of an officer
type OfficerEntry ¶
type OfficerEntry struct { OfficerName Member string `json:"member"` }
OfficerEntry is a structure holding basic information of an officer.
type OfficerEntryChan ¶
type OfficerEntryChan <-chan OfficerEntryResult
OfficerEntryChan is a reciever of db.OfficerEntryResult.
func (OfficerEntryChan) MarshalJSON ¶
func (entryChan OfficerEntryChan) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the remaining entries and closes the channel.
This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
type OfficerEntryResult ¶
type OfficerEntryResult struct { OfficerEntry Error error }
OfficerEntryResult is a strcuture representing a result of querying db.OfficerEntry.
type OfficerName ¶
OfficerName is a structure associating the ID and name of an officer.
type OfficerNameChan ¶
type OfficerNameChan <-chan OfficerNameResult
OfficerNameChan is a reciever of db.OfficerNameResult.
type OfficerNameResult ¶
type OfficerNameResult struct { OfficerName Error error }
OfficerNameResult is a strucutre representing a result of querying db.OfficerName.
type PartyAttendanceChan ¶
type PartyAttendanceChan <-chan PartyAttendanceResult
PartyAttendanceChan is a reciever of db.PartyAttendanceResult.
func (PartyAttendanceChan) MarshalJSON ¶
func (attendanceChan PartyAttendanceChan) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the remaining attendances and closes the channel.
This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
type PartyAttendanceResult ¶
type PartyAttendanceResult struct { Member string Attendance Attendance Error error }
PartyAttendanceResult is a structure representing a result of querying db.PartyAttendance.
type PartyCommon ¶
type PartyCommon struct { Creator encoding.ZeroString `json:"creator"` Start encoding.Time `json:"start"` End encoding.Time `json:"end"` Place string `json:"place"` Inviteds string `json:"inviteds"` Due encoding.Time `json:"due"` }
PartyCommon is a structure holding information about a party common for queries.
type PartyDetail ¶
type PartyDetail struct { PartyCommon Details string `json:"details"` Attendances PartyAttendanceChan `json:"attendances"` }
PartyDetail is a structure holding details of a party.
type PartyEntry ¶
type PartyEntry struct { PartyCommon Name string `json:"name"` }
PartyEntry is a strucutre holding basic information about a party.
type PartyNameChan ¶
type PartyNameChan <-chan PartyNameResult
PartyNameChan is a reciever of db.PartyNameResult.
func (PartyNameChan) MarshalJSON ¶
func (nameChan PartyNameChan) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the remaining names and closes the channel.
This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
type PartyNameResult ¶
PartyNameResult is a structure representing a result of querying names of parties.
type PartyUser ¶
type PartyUser struct { PartyEntry User Attendance `json:"user"` }
PartyUser is a structure holding information of a party and the attendance of the user.
type PartyUserChan ¶
type PartyUserChan <-chan PartyUserResult
PartyUserChan is a reciever of db.PartyUserResult.
func (PartyUserChan) MarshalJSON ¶
func (userChan PartyUserChan) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the remaining parties and closes the channel.
This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
type PartyUserResult ¶
PartyUserResult is a structure representing a result of querying db.PartyUser.
type PositionChan ¶
type PositionChan <-chan PositionResult
PositionChan is a reciver of db.PositionResult.
func (PositionChan) MarshalJSON ¶
func (positionChan PositionChan) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the remaining positions and closes the channel.
This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
type PositionQuerier ¶
type PositionQuerier struct {
// contains filtered or unexported fields
}
PositionQuerier is a structure to provide a feature to query db.Position.
func (PositionQuerier) MarshalJSON ¶
func (querier PositionQuerier) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the positions of a member.
This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
func (PositionQuerier) Query ¶
func (querier PositionQuerier) Query() PositionChan
Query returns db.PositionChan representing the positions of a member.
It will blocks any other operations sharing the context or the database until the channel gets closed.
type PositionResult ¶
PositionResult is a structure holding the result of an action to query the information about a position where a member is.
type RecipientChan ¶
type RecipientChan <-chan RecipientResult
RecipientChan is a reciever of db.RecipientResult.
func (RecipientChan) MarshalJSON ¶
func (recipientChan RecipientChan) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the remaining recipients and closes the channel. This implements an interface used in encoding/encoding.
json - The Go Programming Language Example (CustomMarshalJSON) https://golang.org/pkg/encoding/json/#example__customMarshalJSON
type RecipientResult ¶
RecipientResult is a structure representing a result of querying a recipient.