Documentation
¶
Index ¶
- func Key(entity HasBioDataInterface) string
- type BioData
- type Candidate
- type Election
- type HasBioDataInterface
- type ITYPES
- type PoliticalParty
- type Role
- type SmartContract
- func (s *SmartContract) DeleteCandidate(ctx contractapi.TransactionContextInterface, key string) error
- func (s *SmartContract) DeleteElection(ctx contractapi.TransactionContextInterface, key string) error
- func (s *SmartContract) DeletePoliticalParty(ctx contractapi.TransactionContextInterface, key string) error
- func (s *SmartContract) DeleteVoter(ctx contractapi.TransactionContextInterface, key string) error
- func (s *SmartContract) QueryAllCandidate(ctx contractapi.TransactionContextInterface) ([]Candidate, error)
- func (s *SmartContract) QueryAllElection(ctx contractapi.TransactionContextInterface) ([]Election, error)
- func (s *SmartContract) QueryAllPoliticalParty(ctx contractapi.TransactionContextInterface) ([]PoliticalParty, error)
- func (s *SmartContract) QueryAllVoter(ctx contractapi.TransactionContextInterface) ([]Voter, error)
- func (s *SmartContract) QueryCandidate(ctx contractapi.TransactionContextInterface, key string) (Candidate, error)
- func (s *SmartContract) QueryElection(ctx contractapi.TransactionContextInterface, key string) (Election, error)
- func (s *SmartContract) QueryPoliticalParty(ctx contractapi.TransactionContextInterface, key string) (PoliticalParty, error)
- func (s *SmartContract) QueryVoter(ctx contractapi.TransactionContextInterface, key string) (Voter, error)
- func (s *SmartContract) RegisterCandidate(ctx contractapi.TransactionContextInterface, candidate Candidate) error
- func (s *SmartContract) RegisterElection(ctx contractapi.TransactionContextInterface, election Election) error
- func (s *SmartContract) RegisterPoliticalParty(ctx contractapi.TransactionContextInterface, politicalParty PoliticalParty) error
- func (s *SmartContract) RegisterVoter(ctx contractapi.TransactionContextInterface, voter Voter) error
- func (s *SmartContract) UpdateCandidate(ctx contractapi.TransactionContextInterface, key string, candidate Candidate) error
- func (s *SmartContract) UpdateElection(ctx contractapi.TransactionContextInterface, key string, election Election) error
- func (s *SmartContract) UpdatePoliticalParty(ctx contractapi.TransactionContextInterface, politicalParty PoliticalParty) error
- func (s *SmartContract) UpdateVoter(ctx contractapi.TransactionContextInterface, voter Voter) error
- type Voter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Key ¶
func Key(entity HasBioDataInterface) string
Key returns voter.Biodata.NationalID if voter.Biodata.DID is empty.
Types ¶
type BioData ¶
type BioData struct {
//DID Digital Identifier
DID string
NationalID string
FirstName string
MiddleName string
LastName string
OtherName string
Sex string
BirthDay int
BirtMonth int
BirthYear int
Gender string
Citizenship string
}
BioData is the data of any person that can or cannot vote. Biodata is expected to be extended as demand requires.
func (*BioData) EligibilityToVote ¶
type Candidate ¶
type Candidate struct {
BioData BioData
CandidateID string
CandidatePoliticalParty PoliticalParty
Votes uint64
}
Candidate struct. Candidate is expected to be extended as demand requires.
func (Candidate) HasBioData ¶
type Election ¶
type Election struct {
ElectionYear int
Position string
Contestants []Candidate
Winner map[Role]Candidate
}
Election struct. Election is expected to be extended as demand requires.
type HasBioDataInterface ¶
type HasBioDataInterface interface {
//HasBioData returns BioData type
HasBioData() BioData
}
HasBioDataInterface constraint for type that as Biodata type
type ITYPES ¶
type ITYPES interface {
Voter | Candidate | Election | PoliticalParty
}
ITYPES is a union set type constraint that enforces only allowable types are passed to smartcontract methods.
type PoliticalParty ¶
PoliticalParty struct. PoliticalParty is expected to be extended as demand requires.
type SmartContract ¶
type SmartContract struct {
contractapi.Contract
}
func (*SmartContract) DeleteCandidate ¶
func (s *SmartContract) DeleteCandidate(ctx contractapi.TransactionContextInterface, key string) error
DeleteCandidate deletes candidate from world state.
func (*SmartContract) DeleteElection ¶
func (s *SmartContract) DeleteElection(ctx contractapi.TransactionContextInterface, key string) error
DeleteElection deletes election from world state.
func (*SmartContract) DeletePoliticalParty ¶
func (s *SmartContract) DeletePoliticalParty(ctx contractapi.TransactionContextInterface, key string) error
DeletePoliticalParty deletes politicalparty from world state.
func (*SmartContract) DeleteVoter ¶
func (s *SmartContract) DeleteVoter(ctx contractapi.TransactionContextInterface, key string) error
DeleteVoter deletes voter from world state.
func (*SmartContract) QueryAllCandidate ¶
func (s *SmartContract) QueryAllCandidate(ctx contractapi.TransactionContextInterface) ([]Candidate, error)
QueryAllCandidate queryAlls candidate from world state.Any error encounter would return the function with a nil slice.
func (*SmartContract) QueryAllElection ¶
func (s *SmartContract) QueryAllElection(ctx contractapi.TransactionContextInterface) ([]Election, error)
QueryAllElection queryAlls election from world state. Any error encounter would return the function with a nil slice.
func (*SmartContract) QueryAllPoliticalParty ¶
func (s *SmartContract) QueryAllPoliticalParty(ctx contractapi.TransactionContextInterface) ([]PoliticalParty, error)
QueryAllPoliticalParty queryAlls politicalparty from world state. Any error encounter would return the function with a nil slice.
func (*SmartContract) QueryAllVoter ¶
func (s *SmartContract) QueryAllVoter(ctx contractapi.TransactionContextInterface) ([]Voter, error)
QueryAllVoter queryAlls voter from world state.Any error encounter would return the function with a nil slice.
func (*SmartContract) QueryCandidate ¶
func (s *SmartContract) QueryCandidate(ctx contractapi.TransactionContextInterface, key string) (Candidate, error)
QueryCandidate querys candidate from world state.
func (*SmartContract) QueryElection ¶
func (s *SmartContract) QueryElection(ctx contractapi.TransactionContextInterface, key string) (Election, error)
QueryElection querys election from world state.
func (*SmartContract) QueryPoliticalParty ¶
func (s *SmartContract) QueryPoliticalParty(ctx contractapi.TransactionContextInterface, key string) (PoliticalParty, error)
QueryPoliticalParty querys politicalparty from world state.
func (*SmartContract) QueryVoter ¶
func (s *SmartContract) QueryVoter(ctx contractapi.TransactionContextInterface, key string) (Voter, error)
QueryVoter querys voter from world state.
func (*SmartContract) RegisterCandidate ¶
func (s *SmartContract) RegisterCandidate(ctx contractapi.TransactionContextInterface, candidate Candidate) error
RegisterCandidate registers candidate to world state. candidate is expected to be prepared by the backend.
func (*SmartContract) RegisterElection ¶
func (s *SmartContract) RegisterElection(ctx contractapi.TransactionContextInterface, election Election) error
RegisterElection registers election to world state. election is expected to be prepared by the backend.
func (*SmartContract) RegisterPoliticalParty ¶
func (s *SmartContract) RegisterPoliticalParty(ctx contractapi.TransactionContextInterface, politicalParty PoliticalParty) error
RegisterPoliticalParty registers politicalparty to world state. politicalparty is expected to be prepared by the backend.
func (*SmartContract) RegisterVoter ¶
func (s *SmartContract) RegisterVoter(ctx contractapi.TransactionContextInterface, voter Voter) error
RegisterVoter registers voter to world state. voter is expected to be prepared by the backend.
func (*SmartContract) UpdateCandidate ¶
func (s *SmartContract) UpdateCandidate(ctx contractapi.TransactionContextInterface, key string, candidate Candidate) error
updateCandidate updates candidate from world state. candidate is expected to be prepared by the backend.
func (*SmartContract) UpdateElection ¶
func (s *SmartContract) UpdateElection(ctx contractapi.TransactionContextInterface, key string, election Election) error
updateElection updates election from world state. election is expected to be prepared by the backend.
func (*SmartContract) UpdatePoliticalParty ¶
func (s *SmartContract) UpdatePoliticalParty(ctx contractapi.TransactionContextInterface, politicalParty PoliticalParty) error
updatePoliticalParty updates politicalparty from world state. politicalparty is expected to be prepared by the backend.
func (*SmartContract) UpdateVoter ¶
func (s *SmartContract) UpdateVoter(ctx contractapi.TransactionContextInterface, voter Voter) error
updateVoter updates voter from world state. voter is expected to be prepared by the backend.
type Voter ¶
type Voter struct {
Biodata BioData
VotedCandidateID Candidate
VoterPoliticalParty PoliticalParty
}
Voter struct. Voter is expected to be extended as demand requires.