types

package
v0.0.0-...-6740b9f Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2014 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLocation string = "Europe/Berlin"
)

Variables

View Source
var (
	ClientTokenExpirationTime time.Duration = 8 * time.Hour
)

Functions

func Hash

func Hash(values ...interface{}) string

Types

type AuthOrigin

type AuthOrigin struct {
	Service          AuthOriginService `json:"auth_origin_service" datastore:"-"`
	ServiceFormatted string            `json:"auth_origin_service_formatted" datastore:"-"`
	EntityId         string            `json:"auth_origin_entity_id" datastore:"-"`
	Token            string            `json:"auth_origin_token" datastore:"-"`
}

func (*AuthOrigin) SetFormattedValues

func (self *AuthOrigin) SetFormattedValues()

func (*AuthOrigin) SetServiceFormatted

func (self *AuthOrigin) SetServiceFormatted()

type AuthOriginService

type AuthOriginService int8
var (
	AuthOriginServiceUnknown    AuthOriginService = 0
	AuthOriginServiceGooglePlus AuthOriginService = 1
	AuthOriginServiceFacebook   AuthOriginService = 2
)

func ParseAuthOriginService

func ParseAuthOriginService(value int) AuthOriginService

func (AuthOriginService) String

func (self AuthOriginService) String() string

type Balance

type Balance struct {
	sync.Mutex
	User    User   `json:"user" datastore:"-"`
	Debits  Prices `json:"debits" datastore:"-"`
	Credits Prices `json:"credits" datastore:"-"`
	Price   `json:"balance" datastore:"-"`
}

func NewBalance

func NewBalance(user User) *Balance

func (*Balance) AddCredit

func (self *Balance) AddCredit(price Price)

func (*Balance) AddDebit

func (self *Balance) AddDebit(price Price)

type Balances

type Balances []Balance

type BaseEntity

type BaseEntity struct {
	CreatedAt  RFC3339Time `json:"created_at" datastore:"-" siren:"property"`
	ModifiedAt RFC3339Time `json:"modified_at" datastore:"-" siren:"property"`

	// appengine will not store RFC3339Time, we must store them as time.Time
	CreatedAtTime  time.Time `json:"-" datastore:"created_at"`
	ModifiedAtTime time.Time `json:"-" datastore:"modified_at"`
}

func (*BaseEntity) SetCreatedAt

func (self *BaseEntity) SetCreatedAt(time time.Time)

func (*BaseEntity) SetModifiedAt

func (self *BaseEntity) SetModifiedAt(time time.Time)

func (*BaseEntity) SetTimes

func (self *BaseEntity) SetTimes()

type Client

type Client struct {
	BaseEntity
	Id              ClientId     `json:"id" datastore:"-"`
	Status          ClientStatus `json:"status" datastore:"status"`
	StatusFormatted string       `json:"status_formatted" datastore:"-"`

	// Entity fields
	ClientId    ClientClientId `json:"client_id" datastore:"client_id"`
	ClientToken ClientToken    `json:"token,omitempty" datastore:"token"`
	UserId      UserId         `json:"-" datastore:"user_id"`
	User        User           `json:"user" datastore:"-"`

	// Signup
	AuthOrigin
}

func (*Client) GenerateClientId

func (self *Client) GenerateClientId()

func (*Client) RegenerateToken

func (self *Client) RegenerateToken()

func (*Client) SetFormattedValues

func (self *Client) SetFormattedValues()

func (*Client) SetStatusFormatted

func (self *Client) SetStatusFormatted()

func (*Client) SetTimes

func (self *Client) SetTimes()

type ClientClientId

type ClientClientId string

type ClientId

type ClientId int64

type ClientIds

type ClientIds []ClientId

func (ClientIds) AsInt64Arr

func (self ClientIds) AsInt64Arr() []int64

type ClientStatus

type ClientStatus int8
var (
	ClientStatusDeleted ClientStatus = -1
	ClientStatusUnknown ClientStatus = 0
	ClientStatusActive  ClientStatus = 1
)

func ParseClientStatus

func ParseClientStatus(value int) ClientStatus

func (ClientStatus) String

func (self ClientStatus) String() string

type ClientToken

type ClientToken struct {
	Value        string      `json:"value" datastore:"value"`
	ExpireAt     RFC3339Time `json:"expire_at" datastore:"-" siren:"property"`
	ExpireAtTime time.Time   `json:"-" datastore:"expire_at"`
}

func (*ClientToken) SetTimes

func (self *ClientToken) SetTimes()

type Clients

type Clients []Client

type Comment

type Comment struct {
	BaseEntity
	Id              CommentId     `json:"id" datastore:"-" siren:"property"`
	Status          CommentStatus `json:"status" datastore:"status" siren:"property"`
	StatusFormatted string        `json:"status_formatted" datastore:"-" siren:"property"`

	// Entity fields
	UserId UserId `json:"-" datastore:"user_id"`
	User   User   `json:"user" datastore:"-"`
	Value  string `json:"value" datastore:"value" siren:"property"`

	// Internal fields
	PaymentId PaymentId `json:"-" datastore:"payment_id"`
}

func (*Comment) SetFormattedValues

func (self *Comment) SetFormattedValues()

func (*Comment) SetStatusFormatted

func (self *Comment) SetStatusFormatted()

type CommentId

type CommentId int64

type CommentIds

type CommentIds []CommentId

func (CommentIds) AsInt64Arr

func (self CommentIds) AsInt64Arr() []int64

type CommentStatus

type CommentStatus int8
var (
	CommentStatusDeleted CommentStatus = -1
	CommentStatusUnknown CommentStatus = 0
	CommentStatusActive  CommentStatus = 1
)

func ParseCommentStatus

func ParseCommentStatus(value int) CommentStatus

func (CommentStatus) String

func (self CommentStatus) String() string

type Comments

type Comments []Comment

type CreatedAt

type CreatedAt interface {
	SetCreatedAt(time time.Time)
}

type CreatedAtModifiedAt

type CreatedAtModifiedAt interface {
	CreatedAt
	ModifiedAt
	SetTimes()
}

type Document

type Document struct {
	BaseEntity
	Id              DocumentId     `json:"id" datastore:"-"`
	Status          DocumentStatus `json:"status" datastore:"status"`
	StatusFormatted string         `json:"status_formatted" datastore:"-"`

	// Entity fields
	URL     string `json:"url" datastore:"url"`
	OwnerId UserId `json:"-" datastore:"owner_id"`
	Owner   User   `json:"owner" datastore:"-"`

	// Internal fields
	PaymentId PaymentId `json:"-" datastore:"payment_id"`
}

func (*Document) SetFormattedValues

func (self *Document) SetFormattedValues()

func (*Document) SetStatusFormatted

func (self *Document) SetStatusFormatted()

type DocumentId

type DocumentId int64

type DocumentIds

type DocumentIds []DocumentId

func (DocumentIds) AsInt64Arr

func (self DocumentIds) AsInt64Arr() []int64

type DocumentStatus

type DocumentStatus int8
var (
	DocumentStatusDeleted DocumentStatus = -1
	DocumentStatusUnknown DocumentStatus = 0
	DocumentStatusActive  DocumentStatus = 1
)

func ParseDocumentStatus

func ParseDocumentStatus(value int) DocumentStatus

func (DocumentStatus) String

func (self DocumentStatus) String() string

type Documents

type Documents []Document

type LatitudeLongitude

type LatitudeLongitude struct {
	Latitude  float64            `json:"latitude,omitempty" datastore:"-"`
	Longitude float64            `json:"longitude,omitempty" datastore:"-"`
	GeoPoint  appengine.GeoPoint `json:"-" datastore:"geopoint"`
}

func (*LatitudeLongitude) SetFormattedValues

func (self *LatitudeLongitude) SetFormattedValues()

func (*LatitudeLongitude) SetLatitude

func (self *LatitudeLongitude) SetLatitude()

func (*LatitudeLongitude) SetLatitudeLongitude

func (self *LatitudeLongitude) SetLatitudeLongitude()

func (*LatitudeLongitude) SetLongitude

func (self *LatitudeLongitude) SetLongitude()

type Location

type Location struct {
	Address    string `json:"address,omitempty" datastore:"address,noindex"`
	City       string `json:"city,omitempty" datastore:"city"`
	State      string `json:"state,omitempty" datastore:"state"`
	PostalCode string `json:"postal_code,omitempty" datastore:"postal_code"`
	Country    string `json:"country,omitempty" datastore:"country"`
	LatitudeLongitude
}

func (*Location) SetFormattedValues

func (self *Location) SetFormattedValues()

type ModifiedAt

type ModifiedAt interface {
	SetModifiedAt(time time.Time)
}

type Overview

type Overview struct {
	BaseEntity
	Id              OverviewId     `json:"id" datastore:"-"`
	Status          OverviewStatus `json:"status" datastore:"status"`
	StatusFormatted string         `json:"status_formatted" datastore:"-"`

	// Entity fields
	URLToken     string       `json:"token" datastore:"token"`
	Name         string       `json:"name" datastore:"name"`
	Description  string       `json:"description" datastore:"description"`
	BaseCurrency string       `json:"base_currency" datastore:"base_currency"`
	OwnerId      UserId       `json:"-" datastore:"owner_id"`
	Owner        User         `json:"owner" datastore:"-"`
	Participants Users        `json:"participants" datastore:"-"`
	Payments     Payments     `json:"payments" datastore:"-"`
	UserAccounts UserAccounts `json:"user_accounts" datastore:"-"`
}

func (*Overview) ComputeUserAccounts

func (self *Overview) ComputeUserAccounts()

func (*Overview) SetFormattedValues

func (self *Overview) SetFormattedValues()

func (*Overview) SetStatusFormatted

func (self *Overview) SetStatusFormatted()

type OverviewId

type OverviewId int64

type OverviewIds

type OverviewIds []OverviewId

func (OverviewIds) AsInt64Arr

func (self OverviewIds) AsInt64Arr() []int64

type OverviewStatus

type OverviewStatus int8
var (
	OverviewStatusDeleted OverviewStatus = -1
	OverviewStatusUnknown OverviewStatus = 0
	OverviewStatusActive  OverviewStatus = 1
)

func ParseOverviewStatus

func ParseOverviewStatus(value int) OverviewStatus

func (OverviewStatus) String

func (self OverviewStatus) String() string

type Overviews

type Overviews []Overview

type Payment

type Payment struct {
	BaseEntity
	Id              PaymentId     `json:"id" datastore:"-"`
	Status          PaymentStatus `json:"status" datastore:"status"`
	StatusFormatted string        `json:"status_formatted" datastore:"-"`

	// Entity fields
	PaidAt        RFC3339Time `json:"paid_at" datastore:"-"`
	PaidAtTime    time.Time   `json:"-" datastore:"paid_at"`
	Location      `json:"location" datastore:"location"`
	FromId        UserId `json:"-" datastore:"from_id"`
	From          User   `json:"from" datastore:"-"`
	ToId          UserId `json:"-" datastore:"to_id"`
	To            User   `json:"to" datastore:"-"`
	PaymentMethod `json:"payment_method" datastore:"payment_method"`
	Price         `json:"price" datastore:"price"`

	// Internal fields
	OverviewId OverviewId `json:"-" datastore:"overview_id"`
}

func (*Payment) SetFormattedValues

func (self *Payment) SetFormattedValues()

func (*Payment) SetStatusFormatted

func (self *Payment) SetStatusFormatted()

func (*Payment) SetTimes

func (self *Payment) SetTimes()

type PaymentId

type PaymentId int64

type PaymentIds

type PaymentIds []PaymentId

func (PaymentIds) AsInt64Arr

func (self PaymentIds) AsInt64Arr() []int64

type PaymentMethod

type PaymentMethod struct {
	Kind          PaymentMethodKind `json:"kind" datastore:"kind"`
	KindFormatted string            `json:"kind_formatted" datastore:"-"`
	Comment       string            `json:"comment" datastore:"comment"`
}

func (*PaymentMethod) SetFormattedValues

func (self *PaymentMethod) SetFormattedValues()

type PaymentMethodKind

type PaymentMethodKind int8
var (
	PaymentMethodKindUnknown      PaymentMethodKind = 0
	PaymentMethodKindCash         PaymentMethodKind = 1
	PaymentMethodKindCredit       PaymentMethodKind = 2
	PaymentMethodKindDebit        PaymentMethodKind = 4
	PaymentMethodKindCheque       PaymentMethodKind = 8
	PaymentMethodKindBankTransfer PaymentMethodKind = 16
	PaymentMethodKindOther        PaymentMethodKind = 32
)

func ParsePaymentMethodKind

func ParsePaymentMethodKind(value int) PaymentMethodKind

func (PaymentMethodKind) String

func (self PaymentMethodKind) String() string

type PaymentStatus

type PaymentStatus int8
var (
	PaymentStatusDeleted   PaymentStatus = -1
	PaymentStatusUnknown   PaymentStatus = 0
	PaymentStatusActive    PaymentStatus = 1
	PaymentStatusCancelled PaymentStatus = 2
)

func ParsePaymentStatus

func ParsePaymentStatus(value int) PaymentStatus

func (PaymentStatus) String

func (self PaymentStatus) String() string

type Payments

type Payments []Payment

type Price

type Price struct {
	Value          int64  `json:"value" datastore:"value"`
	ValueFormatted string `json:"value_formatted" datastore:"-"`
	Currency       string `json:"currency" datastore:"currency"`
}

func (*Price) SetValueFormatted

func (self *Price) SetValueFormatted()

type Prices

type Prices []Price

type RFC3339Time

type RFC3339Time time.Time

func (RFC3339Time) MarshalJSON

func (self RFC3339Time) MarshalJSON() ([]byte, error)

func (*RFC3339Time) UnmarshalJSON

func (self *RFC3339Time) UnmarshalJSON(value []byte) error

type User

type User struct {
	BaseEntity
	Id              UserId     `json:"id" datastore:"-" siren:"property"`
	Status          UserStatus `json:"status" datastore:"status" siren:"property"`
	StatusFormatted string     `json:"status_formatted" datastore:"-" siren:"property"`

	// Entity fields
	FullName string `json:"full_name" datastore:"full_name" siren:"property"`
	Email    string `json:"email" datastore:"email" siren:"property"`

	// Internal fields
	GooglePlusId string `json:"-" datastore:"google_plus_id"`
	FacebookId   string `json:"-" datastore:"facebook_id"`
}

func (*User) SetFormattedValues

func (self *User) SetFormattedValues()

func (*User) SetStatusFormatted

func (self *User) SetStatusFormatted()

type UserAccount

type UserAccount struct {
	User     User                `json:"user" datastore:"-"`
	Balances map[UserId]*Balance `json:"balances" datastore:"-"`
}

func NewUserAccount

func NewUserAccount(user User) *UserAccount

type UserAccounts

type UserAccounts []UserAccount

type UserId

type UserId int64

type UserIds

type UserIds []UserId

func (UserIds) AsInt64Arr

func (self UserIds) AsInt64Arr() []int64

type UserOverview

type UserOverview struct {
	BaseEntity
	Id              UserOverviewId     `json:"id" datastore:"-" siren:"property"`
	Status          UserOverviewStatus `json:"status" datastore:"status" siren:"property"`
	StatusFormatted string             `json:"status_formatted" datastore:"-" siren:"property"`

	// Internal fields
	OverviewId OverviewId `json:"overview_id" datastore:"overview_id"`
	UserId     UserId     `json:"user_id" datastore:"user_id"`
}

func (*UserOverview) SetFormattedValues

func (self *UserOverview) SetFormattedValues()

func (*UserOverview) SetStatusFormatted

func (self *UserOverview) SetStatusFormatted()

type UserOverviewId

type UserOverviewId int64

type UserOverviewIds

type UserOverviewIds []UserOverviewId

func (UserOverviewIds) AsInt64Arr

func (self UserOverviewIds) AsInt64Arr() []int64

type UserOverviewStatus

type UserOverviewStatus int8
var (
	UserOverviewStatusDeleted UserOverviewStatus = -1
	UserOverviewStatusUnknown UserOverviewStatus = 0
	UserOverviewStatusActive  UserOverviewStatus = 1
)

func ParseUserOverviewStatus

func ParseUserOverviewStatus(value int) UserOverviewStatus

func (UserOverviewStatus) String

func (self UserOverviewStatus) String() string

type UserOverviews

type UserOverviews []UserOverview

type UserStatus

type UserStatus int8
var (
	UserStatusDeleted UserStatus = -1
	UserStatusUnknown UserStatus = 0
	UserStatusActive  UserStatus = 1
)

func ParseUserStatus

func ParseUserStatus(value int) UserStatus

func (UserStatus) String

func (self UserStatus) String() string

type Users

type Users []User

Jump to

Keyboard shortcuts

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