Documentation ¶
Index ¶
- func DeletePerson(engine *xorm.Engine, IDPerson uint16) error
- func DeleteTransaction(engine *xorm.Engine, IDTransaction uint16) error
- func GetEngine(databaseFile string) (*xorm.Engine, error)
- func GetParticipants(engine *xorm.Engine, hash string) (*[]Person, error)
- func GetTransactions(engine *xorm.Engine, hash string) (*[]Transaction, error)
- func PutPerson(engine *xorm.Engine, person *Person) error
- func PutTransaction(engine *xorm.Engine, transaction *Transaction) error
- func WritePognon(engine *xorm.Engine, pognon *PognonJSON) error
- func WriteTransaction(engine *xorm.Engine, transaction *Transaction) error
- type Person
- type Pognon
- type PognonJSON
- type Purchase
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeletePerson ¶
DeletePerson delete a person from database Before deleting we need to check if the person is involved in any transaction. Otherwise all debt will be wrong.
func DeleteTransaction ¶
DeleteTransaction delete a transaction from database
func GetParticipants ¶
GetParticipants given a pognon hash return list of participants
func GetTransactions ¶
func GetTransactions(engine *xorm.Engine, hash string) (*[]Transaction, error)
GetTransactions for a given pognon hash get the corresponding transactions
func PutTransaction ¶
func PutTransaction(engine *xorm.Engine, transaction *Transaction) error
PutTransaction perform update on a transaction
func WritePognon ¶
func WritePognon(engine *xorm.Engine, pognon *PognonJSON) error
WritePognon write a new Pognon to database
func WriteTransaction ¶
func WriteTransaction(engine *xorm.Engine, transaction *Transaction) error
WriteTransaction write a transaction to database
Types ¶
type Person ¶
type Person struct { IDPerson uint16 `xorm:"pk SERIAL"` Name string PognonHash string `xorm:"INDEX DEFAULT ''" json:"-"` }
Person is a participant to a pognon
type Pognon ¶
type Pognon struct { IDPognon uint16 `xorm:"pk SERIAL" json:"-"` PognonHash string `xorm:"unique index"` // Random hash to identify pognon }
Pognon is a list of transactions and participants
type PognonJSON ¶
type PognonJSON struct { Pognon *Pognon Participants *[]Person Transactions *[]Transaction }
PognonJSON is a structured response to a pongon request
func GetPognonJSON ¶
func GetPognonJSON(engine *xorm.Engine, hash string) (*PognonJSON, error)
GetPognonJSON given a hash build a JSON response with corresponding pognon
type Transaction ¶
type Transaction struct { IDTransaction uint16 `xorm:"pk SERIAL"` PognonHash string `xorm:"NOT NULL INDEX DEFAULT ''" json:"-"` // Reference to a pognon Buyers []Purchase // The ones who payed and how much For []Purchase // The ones who used the money and how much Reason string // What was payed CreatedAt time.Time `xorm:"created"` UpdatedAt time.Time `xorm:"updated"` }
Transaction is a money transaction for a Pognon