nerdz

package
v0.0.0-...-826f942 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2017 License: AGPL-3.0 Imports: 19 Imported by: 0

README

NERDZ-API - Back-end

In this folder you can find the NERDZ back-end implementation.

Back-end types architecture

In the implementation of the NERDZ's type hierarchy, a lot of data structure are generated in order to manipulate all the information that the social network manages. All the data structure are filled by a database ORM that is used to avoid to rely on the specific query dialect when creating each query. In order to work with it, a specific type has been defined in the file types.go which contains specific details that grant to the ORM to manage all the database's logic.

All the information it's not simply generated and consumed inside the system. In making available an API, we need to decouple all the internal data structure from the one that are returned to the user by the system. It's absolutely NOT correct to return all the data exactly has they are stored in the database. For this reason, according to the state-of-the-art pattern of the Transfer Object, we have defined a main structure and a specific transfer object type which can be generated from it.

In particular, each type defined in the file types.go implements a specific interface, called Transferable, which let to it to define how will be generated the companion transfer object type defined in the file api_types.go. Each transfer object type associated to the main struct, doesn't have all the ORM details and is completely seperated from the database's logic.

Working in this way, will be necessary, to get each transfer object specific type for a data structure, to work a little with type conversion and type switch. In a first moment this could be really tedious, but this approach has a lot of benefits that are appreciable only in the long-run.

Back-end tests

Tests are based on nerdz-test-db. If you want to run rests you must correctly setup this environment.

cd ~/nerdz_env/
git clone https://github.com/nerdzeu/nerdz-test-db.git

You don't need to do anything else in that folder.

Come back here and properly setup your JSON configuration file in order to use a new test-db.

Mine looks like:

{
    "DbUsername" : "test_db",
    "DbPassword" : "test_db",
    "DbName"     : "test_db",
    "DbHost"     : "127.0.0.1",
    "DbPort"     : 0,
    "DbSSLMode"    : "disable",
    "NERDZPath"  : "/home/paolo/nerdz_env/nerdz.eu/",
    "NERDZHost"  : "local.nerdz.eu",
    "EnableLog"  : true,
    "Port"       : 9090,
    "Scheme"     : "http",
    "Host"       : "local.api.nerdz.eu"
}

After that, configure the nvironment variables into test_all.sh.

Run the tests

To run all the test, you need a working database. If you wanto to automatically create a new database, use ./test_all.sh.

If your nerdz-test-db is just ready thus you don't need to create a new one, you can lunch tests in these two ways:

CONF_FILE="/path/to/conf_file/conf_file_name" go test

If you want to see which queries are executed run tests with EnableLog parameter set to true in the configuration file and using the verbose mode for the test tool:

CONF_FILE="/path/to/conf_file/conf_file_name" go test -v |less

Documentation

Index

Constants

View Source
const (
	// MinPosts represents the minimum posts number that can be required in a postList
	MinPosts uint64 = 1
	// MaxPosts represents the maximum posts number that can be required in a postList
	MaxPosts uint64 = 20

	// MinComments represents the minimum comments number that can be required in a commentList
	MinComments uint64 = 1
	// MaxComments represents the maximum comments number that can be required in a commentList
	MaxComments uint64 = 20
)
View Source
const (
	// UserBoardID constant (of type boardType) makes possible to distinguish a User
	// board from a Project board
	UserBoardID boardType = "user"
	// ProjectBoardID constant (of type boardType) makes possible to distinguish a PROJECT
	// board from a User board
	ProjectBoardID boardType = "project"
)
View Source
const (
	// MinPms represents the minimum pms number that can be required in a conversation
	MinPms uint64 = 1
	// MaxPms represents the maximum pms number that can be required in a conversation
	MaxPms uint64 = 20
)
View Source
const (
	// UserPostID constaint is the numeric identifier of a user post
	// when considered as a generic message
	UserPostID = 1
	// ProjectPostID constaint is the numeric identifier of a project post
	// when considered as a generic message
	ProjectPostID = 0
)

Variables

This section is empty.

Functions

func AtMostComments

func AtMostComments(n uint64) uint8

AtMostComments returns a uint64 that's the number of comments to be retrieved

func AtMostPms

func AtMostPms(n uint64) uint8

AtMostPms returns a uint64 that's the number of pms to be retrieved

func AtMostPosts

func AtMostPosts(n uint64) uint8

AtMostPosts returns a uint8 that's the number of posts to be retrieved

func Db

func Db() *igor.Database

Db returns the *igor.Database

Types

type Ban

type Ban struct {
	User       uint64
	Motivation string
	Time       time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter    uint64    `igor:"primary_key"`
}

Ban is the model for the relation ban

func (*Ban) GetTO

func (b *Ban) GetTO(users ...*User) *BanTO

GetTO returns its Transfer Object

func (Ban) TableName

func (Ban) TableName() string

TableName returns the table name associated with the structure

type BanTO

type BanTO struct {
	User       *InfoTO   `json:"user"`
	Motivation string    `json:"motivation"`
	Time       time.Time `json:"time"`
	Timestamp  int64     `json:"timestamp"`
	Counter    uint64    `json:"counter"`
	// contains filtered or unexported fields
}

BanTO represents the TO of Ban

swagger:model

func (*BanTO) Original

func (to *BanTO) Original() *Ban

Original returns the original object of the TO

type Blacklist

type Blacklist struct {
	From       uint64
	To         uint64
	Motivation string
	Time       time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter    uint64    `igor:"primary_key"`
}

Blacklist is the model for the relation blacklist

func (*Blacklist) GetTO

func (b *Blacklist) GetTO(users ...*User) *BlacklistTO

GetTO returns its Transfer Object

func (Blacklist) TableName

func (Blacklist) TableName() string

TableName returns the table name associated with the structure

type BlacklistTO

type BlacklistTO struct {
	FromInfo   *InfoTO   `json:"from"`
	ToInfo     *InfoTO   `json:"to"`
	Motivation string    `json:"motivation"`
	Time       time.Time `json:"time"`
	Timestamp  int64     `json:"timestamp"`
	Counter    uint64    `json:"counter"`
	// contains filtered or unexported fields
}

BlacklistTO represens the TO of Blacklist

swagger:model

func (*BlacklistTO) Original

func (to *BlacklistTO) Original() *Blacklist

Original returns the original object of the TO

type Board

type Board interface {
	Info() *Info
	// The return value type of Postlist must be changed by type assertion.
	Postlist(PostlistOptions) *[]ExistingPost
}

Board is the interface that wraps the methods common to every board. Every board has its own Informations and Postlist

type BoardInfo

type BoardInfo struct {
	Language       string
	Template       *Template
	MobileTemplate *Template
	Dateformat     string
	IsClosed       bool
	Private        bool
	Whitelist      []*User
	UserScript     *url.URL
}

BoardInfo is that struct that contains all the informations related to the user's board

type Bookmark

type Bookmark interface {
	// contains filtered or unexported methods
}

Bookmark is a generic interface to represent a bookmark

type CommentlistOptions

type CommentlistOptions struct {
	N     uint8  // number of comments to return
	Older uint64 // if specified, tells to the function that is using this struct to return N comments OLDER (created before) than the comment with the spefified "Older" ID
	Newer uint64 // if specified, tells to the function that is using this struct to return N comments NEWER (created after) than the comment with the spefified "Newer" ID
}

CommentlistOptions is used to specify the options for a list of comments

type Config

type Config struct {
	DbUsername string
	DbPassword string // optional -> default:
	DbName     string
	DbHost     string // optional -> default: localhost
	DbPort     int16  // optional -> default: 5432
	DbSSLMode  string // optional -> default: disable
	NERDZPath  string
	NERDZHost  string
	Languages  []string
	Scopes     []string
	Templates  map[uint8]string
	EnableLog  bool  //optional: default: false
	Port       int16 // API port, optional -> default: 7536
	Host       string
	Scheme     string
}

Config represents the configuration file structure

var Configuration *Config

Configuration represent the parsed configuration file

func (*Config) APIURL

func (conf *Config) APIURL() *url.URL

APIURL returns the the API host:port URL

func (*Config) ConnectionString

func (conf *Config) ConnectionString() (string, error)

ConnectionString returns a valid connection string on success, Error otherwise

func (*Config) NERDZURL

func (conf *Config) NERDZURL() *url.URL

NERDZURL returns the NERDZ URL, with https protocol

type ContactInfo

type ContactInfo struct {
	Website  *url.URL
	GitHub   *url.URL
	Skype    string
	Jabber   string
	Yahoo    *mail.Address
	Facebook *url.URL
	Twitter  *url.URL
	Steam    string
}

ContactInfo is the struct that contains all the contact info of an user

func (*ContactInfo) GetTO

func (c *ContactInfo) GetTO() *ContactInfoTO

GetTO returns its Transfer Object

type ContactInfoTO

type ContactInfoTO struct {
	Website  string `json:"website"`
	GitHub   string `json:"github"`
	Skype    string `json:"skype"`
	Jabber   string `json:"jabber"`
	Yahoo    string `json:"yahoo"`
	Facebook string `json:"facebook"`
	Twitter  string `json:"twitter"`
	Steam    string `json:"steam"`
	// contains filtered or unexported fields
}

ContactInfoTO represents the TO of ContactInfo

swagger:model

func (*ContactInfoTO) Original

func (to *ContactInfoTO) Original() *ContactInfo

Original returns the original object of the TO

type Conversation

type Conversation struct {
	From        uint64
	To          uint64
	LastMessage string
	Time        time.Time
	ToRead      bool
}

Conversation represents the details about a single private conversation between two users

func (*Conversation) GetTO

func (c *Conversation) GetTO(users ...*User) *ConversationTO

GetTO returns is Transfer Object

type ConversationTO

type ConversationTO struct {
	FromInfo    *InfoTO   `json:"from"`
	ToInfo      *InfoTO   `json:"to"`
	LastMessage string    `json:"lastMessage"`
	Time        time.Time `json:"time"`
	Timestamp   int64     `json:"timestamp"`
	ToRead      bool      `json:"toRead"`
	// contains filtered or unexported fields
}

ConversationTO represents the TO of Conversation

swagger:model

func (*ConversationTO) Original

func (to *ConversationTO) Original() *Conversation

Original returns the original object of the TO

type DeletedUser

type DeletedUser struct {
	Counter    uint64 `igor:"primary_key"`
	Username   string
	Time       time.Time `sql:"default:(now() at time zone 'utc')"`
	Motivation string
}

DeletedUser is the model for the relation deleted_users

func (*DeletedUser) GetTO

func (u *DeletedUser) GetTO(users ...*User) *DeletedUserTO

GetTO returns its Transfer Object

func (DeletedUser) TableName

func (DeletedUser) TableName() string

TableName returns the table name associated with the structure

type DeletedUserTO

type DeletedUserTO struct {
	Counter    uint64    `json:"counter"`
	Username   string    `json:"username"`
	Time       time.Time `json:"time"`
	Timestamp  int64     `json:"timestamp"`
	Motivation string    `json:"motivation"`
	// contains filtered or unexported fields
}

DeletedUserTO represents the TO of DeletedUserTO

swagger:model

func (*DeletedUserTO) Original

func (to *DeletedUserTO) Original() *DeletedUser

Original returns the original object of the TO

type ExistingComment

type ExistingComment interface {
	Post() (ExistingPost, error)
	// contains filtered or unexported methods
}

ExistingComment is the interface that wraps the methods common to every existing comment

type ExistingPost

type ExistingPost interface {
	Comments(CommentlistOptions) *[]ExistingComment
	CommentsCount() uint8
	NumericBookmarkers() []uint64
	Bookmarkers() []*User
	BookmarksCount() uint8
	Bookmarks() *[]Bookmark
	NumericLurkers() []uint64
	Lurkers() []*User
	LurkersCount() uint8
	Lurks() *[]Lurk
	URL() *url.URL
	IsClosed() bool
	NumericType() uint8
	Type() string
	// contains filtered or unexported methods
}

ExistingPost is the interface that wraps the methods common to every existing post

type Info

type Info struct {
	ID          uint64
	Owner       *Info
	Name        string
	Username    string
	Website     *url.URL
	Image       *url.URL
	Closed      bool
	Type        boardType
	BoardString string
}

Info contains the informations common to every board Used in API output to give user/project basic informations

func Infos

func Infos(slice interface{}) []*Info

Infos returns a slice of pointer to Info

func (*Info) GetTO

func (i *Info) GetTO() *InfoTO

GetTO returns its Transfer Object

type InfoTO

type InfoTO struct {
	ID          uint64    `json:"id"`
	Owner       *InfoTO   `json:"owner"`
	Name        string    `json:"name"`
	Username    string    `json:"username"`
	Website     string    `json:"website"`
	Image       string    `json:"image"`
	Closed      bool      `json:"closed"`
	Type        boardType `json:"type"`
	BoardString string    `json:"board"`
	// contains filtered or unexported fields
}

InfoTO represents the TO of Info

swagger:model

func (*InfoTO) Original

func (to *InfoTO) Original() *Info

Original returns the original object of the TO

type Interest

type Interest struct {
	ID    uint64 `igor:"primary_key"`
	From  uint64
	Value string
	Time  time.Time `sql:"default:(now() at time zone 'utc')"`
}

Interest is the model for the relation interests

func (Interest) TableName

func (Interest) TableName() string

TableName returns the table name associated with the structure

type Lock

type Lock interface {
	// contains filtered or unexported methods
}

Lock is a generic interface to represent the Lock action

type Lurk

type Lurk interface {
	// contains filtered or unexported methods
}

Lurk is a generic interface to represent the Lurk action

type Mention

type Mention struct {
	ID       uint64 `igor:"primary_key"`
	UHpid    uint64
	GHpid    uint64
	From     uint64
	To       uint64
	Time     time.Time `sql:"default:(now() at time zone 'utc')"`
	ToNotify bool
}

Mention is the model for the relation mentions

func (*Mention) GetTO

func (m *Mention) GetTO(users ...*User) *MentionTO

GetTO returns its Transfer Object

func (Mention) TableName

func (Mention) TableName() string

TableName returns the table name associated with the structure

type MentionTO

type MentionTO struct {
	ID        uint64    `json:"id"`
	UHpid     uint64    `json:"uHpid"`
	GHpid     uint64    `json:"gHpid"`
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	ToNotify  bool      `json:"toNotify"`
	// contains filtered or unexported fields
}

MentionTO represents the TO of Mention

swagger:model

func (*MentionTO) Original

func (to *MentionTO) Original() *Mention

Original returns the original object of the TO

type Message

type Message struct {
	Post
	Type uint8
}

Message is the model for the view message

func (*Message) GetTO

func (p *Message) GetTO(users ...*User) *PostTO

GetTO returns its Transfer Object

func (Message) TableName

func (Message) TableName() string

TableName returns the table name associated with the structure

type OAuth2AccessData

type OAuth2AccessData struct {
	ID uint64 `igor:"primary_key"`
	// ClientID references the client that created this token
	ClientID uint64
	// CreatedAt is the instant of creation of the OAuth2AccessToken
	CreatedAt time.Time `sql:"default:(now() at time zone 'utc')"`
	// ExpiresIn is the seconds from CreatedAt before this token expires
	ExpiresIn uint64
	// RedirectUri is the RedirectUri associated with the token
	RedirectURI string
	// AuthorizeDataID references the AuthorizationData that authorizated this token. Can be null
	AuthorizeDataID sql.NullInt64 `igor:"column:oauth2_authorize_id"` // Annotation required, since the column name does not follow igor conventions
	// AccessDataID references the Access Data, for refresh token. Can be null
	AccessDataID sql.NullInt64 `igor:"column:oauth2_access_id"` // Annotation required, since the column name does not follow igor conventions
	// RefreshTokenID is the value by which this token can be renewed. Can be null
	RefreshTokenID sql.NullInt64
	// AccessToken is the main value of this tructure, represents the access token
	AccessToken string
	// Scope is the requested scope
	Scope string
	// UserID is references the User that created The access request and thus the AccessData
	UserID uint64
}

OAuth2AccessData is the OAuth2 access data

func (OAuth2AccessData) TableName

func (OAuth2AccessData) TableName() string

TableName returns the table name associated with the structure

type OAuth2AuthorizeData

type OAuth2AuthorizeData struct {
	// Surrogated key
	ID uint64 `igor:"primary_key"`
	// ClientID references the client that created this token
	ClientID uint64
	// Code is the Authorization code
	Code string
	// CreatedAt is the instant of creation of the OAuth2AuthorizeToken
	CreatedAt time.Time `sql:"default:(now() at time zone 'utc')"`
	// ExpiresIn is the seconds from CreatedAt before this token expires
	ExpiresIn uint64
	// State data from request
	//State string, [!] we dont't store state variables
	// Scope is the requested scope
	Scope string
	// RedirectUri is the RedirectUri associated with the token
	RedirectURI string
	// UserID is references the User that created the authorization request and thus the AuthorizeData
	UserID uint64
}

OAuth2AuthorizeData is the model for the relation oauth2_authorize that represents the authorization granted to to the client

func (OAuth2AuthorizeData) TableName

func (OAuth2AuthorizeData) TableName() string

TableName returns the table name associated with the structure

type OAuth2Client

type OAuth2Client struct {
	// Surrogated key
	ID uint64 `igor:"primary_key"`
	// Real Primary Key. Application (client) name
	Name string `sql:"UNIQUE"`
	// Secret is the unique secret associated with a client
	Secret string `sql:"UNIQUE"`
	// RedirectURI is the valid redirection URI associated with a client
	RedirectURI string
	// UserID references User that created this client
	UserID uint64
}

OAuth2Client implements the osin.Client interface

func (*OAuth2Client) GetId

func (d *OAuth2Client) GetId() string

GetId returns the client ID

func (*OAuth2Client) GetRedirectUri

func (d *OAuth2Client) GetRedirectUri() string

GetRedirectUri returns the client redirect URI

func (*OAuth2Client) GetSecret

func (d *OAuth2Client) GetSecret() string

GetSecret returns the client secret

func (*OAuth2Client) GetUserData

func (d *OAuth2Client) GetUserData() interface{}

GetUserData returns client UserData

func (OAuth2Client) TableName

func (OAuth2Client) TableName() string

TableName returns the table name associated with the structure

type OAuth2RefreshToken

type OAuth2RefreshToken struct {
	ID    uint64 `igor:"primary_key"`
	Token string `sql:"UNIQUE"`
}

OAuth2RefreshToken is the model for the relation oauth2_refresh

func (OAuth2RefreshToken) TableName

func (OAuth2RefreshToken) TableName() string

TableName returns the table name associated with the structure

type OAuth2Storage

type OAuth2Storage struct {
}

OAuth2Storage implements osin.Storage interface

func (*OAuth2Storage) Clone

func (s *OAuth2Storage) Clone() osin.Storage

Clone the storage if needed. For example, using mgo, you can clone the session with session.Clone to avoid concurrent access problems. This is to avoid cloning the connection at each method access. Can return itself if not a problem.

func (*OAuth2Storage) Close

func (s *OAuth2Storage) Close()

Close the resources the Storage potentially holds (using Clone for example)

func (*OAuth2Storage) CreateClient

func (s *OAuth2Storage) CreateClient(c osin.Client, name string) (*OAuth2Client, error)

CreateClient creates a new OAuth2 Client

func (*OAuth2Storage) GetClient

func (s *OAuth2Storage) GetClient(id string) (osin.Client, error)

GetClient loads the client by id (client_id)

func (*OAuth2Storage) LoadAccess

func (s *OAuth2Storage) LoadAccess(token string) (*osin.AccessData, error)

LoadAccess retrieves access data by token. osin.Client information MUST be loaded together. osin.AuthorizeData and osin.AccessData DON'T NEED to be loaded if not easily available. Optionally can return error if expired.

func (*OAuth2Storage) LoadAuthorize

func (s *OAuth2Storage) LoadAuthorize(code string) (*osin.AuthorizeData, error)

LoadAuthorize looks up osin.AuthorizeData by a code. osin.Client information MUST be loaded together. Optionally can return error if expired.

func (*OAuth2Storage) LoadRefresh

func (s *OAuth2Storage) LoadRefresh(token string) (*osin.AccessData, error)

LoadRefresh retrieves refresh osin.AccessData. osin.Client information MUST be loaded together. osin.AuthorizeData and osin.AccessData DON'T NEED to be loaded if not easily available. Optionally can return error if expired.

func (*OAuth2Storage) RemoveAccess

func (s *OAuth2Storage) RemoveAccess(token string) error

RemoveAccess revokes or deletes an osin.AccessData.

func (*OAuth2Storage) RemoveAuthorize

func (s *OAuth2Storage) RemoveAuthorize(code string) error

RemoveAuthorize revokes or deletes the authorization code.

func (*OAuth2Storage) RemoveClient

func (s *OAuth2Storage) RemoveClient(id uint64) error

RemoveClient removes the client by id (primary key)

func (*OAuth2Storage) RemoveRefresh

func (s *OAuth2Storage) RemoveRefresh(token string) error

RemoveRefresh revokes or deletes refresh osin.AccessData.

func (*OAuth2Storage) SaveAccess

func (s *OAuth2Storage) SaveAccess(accessData *osin.AccessData) error

SaveAccess writes osin.AccessData. If RefreshToken is not blank, it must save in a way that can be loaded using LoadRefresh.

func (*OAuth2Storage) SaveAuthorize

func (s *OAuth2Storage) SaveAuthorize(data *osin.AuthorizeData) error

SaveAuthorize saves authorize data.

func (*OAuth2Storage) UpdateClient

func (s *OAuth2Storage) UpdateClient(c osin.Client) (*OAuth2Client, error)

UpdateClient update client with id c.GetId()

type PersonalInfo

type PersonalInfo struct {
	IsOnline  bool
	Nation    string
	Timezone  string
	Username  string
	Name      string
	Surname   string
	Gender    bool
	Birthday  time.Time
	Gravatar  *url.URL
	Interests []string
	Quotes    []string
	Biography string
}

PersonalInfo is the struct that contains all the personal info of an user

func (*PersonalInfo) GetTO

func (p *PersonalInfo) GetTO() *PersonalInfoTO

GetTO returns its Transfer Object

type PersonalInfoTO

type PersonalInfoTO struct {
	ID        uint64    `json:"id"`
	IsOnline  bool      `json:"online"`
	Nation    string    `json:"nation"`
	Timezone  string    `json:"timezone"`
	Username  string    `json:"username"`
	Name      string    `json:"name"`
	Surname   string    `json:"surname"`
	Gender    bool      `json:"gender"`
	Birthday  time.Time `json:"birthday"`
	Gravatar  string    `json:"gravatar"`
	Interests []string  `json:"interests"`
	Quotes    []string  `json:"quotes"`
	Biography string    `json:"biography"`
	// contains filtered or unexported fields
}

PersonalInfoTO represents the TO of PersonalInfo

swagger:model

func (*PersonalInfoTO) Original

func (to *PersonalInfoTO) Original() *PersonalInfo

Original returns the original object of the TO

type Pm

type Pm struct {
	Pmid    uint64 `igor:"primary_key"`
	From    uint64
	To      uint64
	Message string
	Lang    string
	ToRead  bool
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
}

Pm is the model for the relation pms

func NewPm

func NewPm(pmid uint64) (*Pm, error)

NewPm initializes a Pm struct

func NewPmWhere

func NewPmWhere(description *Pm) (pm *Pm, e error)

NewPmWhere returns the *Pm fetching the first one that matches the description

func (*Pm) ClearDefaults

func (pm *Pm) ClearDefaults()

ClearDefaults set to the go's default values the fields with default sql values

func (*Pm) GetTO

func (p *Pm) GetTO(users ...*User) *PmTO

GetTO returns its Transfer Object

func (*Pm) ID

func (pm *Pm) ID() uint64

ID returns the User Post ID

func (*Pm) IsEditable

func (pm *Pm) IsEditable() bool

IsEditable returns true if the pm is editable

func (*Pm) Language

func (pm *Pm) Language() string

Language returns the message language

func (*Pm) NumericOwners

func (pm *Pm) NumericOwners() []uint64

NumericOwners returns a slice of ids of the owner of the pms (the ones that can perform actions)

func (*Pm) NumericReference

func (pm *Pm) NumericReference() uint64

NumericReference returns the id of the recipient user

func (*Pm) NumericSender

func (pm *Pm) NumericSender() uint64

NumericSender returns the id of the sender user

func (*Pm) Owners

func (pm *Pm) Owners() (ret []*User)

Owners returns a slice of *User representing the users who own the pm

func (*Pm) Reference

func (pm *Pm) Reference() Reference

Reference returns the recipient *User

func (*Pm) Revisions

func (pm *Pm) Revisions() (modifications []string)

Revisions returns all the revisions of the message

func (*Pm) RevisionsNumber

func (pm *Pm) RevisionsNumber() uint8

RevisionsNumber returns the number of the revisions

func (*Pm) Sender

func (pm *Pm) Sender() *User

Sender returns the sender *User

func (*Pm) SetLanguage

func (pm *Pm) SetLanguage(language string) error

SetLanguage set the language of the pm (useless)

func (*Pm) SetReference

func (pm *Pm) SetReference(id uint64)

SetReference sets the destionation of the pm: user ID

func (*Pm) SetSender

func (pm *Pm) SetSender(id uint64)

SetSender sets the source of the pm (the user ID)

func (*Pm) SetText

func (pm *Pm) SetText(message string)

SetText set the text of the message

func (Pm) TableName

func (Pm) TableName() string

TableName returns the table name associated with the structure

func (*Pm) Text

func (pm *Pm) Text() string

Text returns the pm message

func (*Pm) Votes

func (pm *Pm) Votes() (votes *[]Vote)

Voters returns a slice of *Vote representing the votes

func (*Pm) VotesCount

func (pm *Pm) VotesCount() int

Votes returns the pm's votes value

type PmTO

type PmTO struct {
	Pmid      uint64    `json:"pmid"`
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Message   string    `json:"message"`
	Lang      string    `json:"lang"`
	ToRead    bool      `json:"toRead"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	CanEdit   bool      `json:"canEdit"`
	CanDelete bool      `json:"canDelete"`
	// contains filtered or unexported fields
}

PmTO represents the TO of Pm

swagger:model

func (*PmTO) Original

func (to *PmTO) Original() *Pm

Original returns the original object of the TO

type PmsOptions

type PmsOptions struct {
	N     uint8  // number of pms to return
	Older uint64 // if specified, tells to the function that is using this struct to return N pms OLDER (created before) than the pms with the specified "Older" ID
	Newer uint64 // if specified, tells to the function that is using this struct to return N pms NEWER (created after) than the comment with the spefified "Newer" ID
}

PmsOptions represent the configuration used to fetch a Pm list

type Post

type Post struct {
	Hpid    uint64 `igor:"primary_key"`
	From    uint64
	To      uint64
	Pid     uint64 `sql:"default:0"`
	Message string
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Lang    string
	News    bool
	Closed  bool
}

Post is the type of a generic post

func (*Post) GetTO

func (p *Post) GetTO(users ...*User) *PostTO

GetTO returns its Transfer Object

func (*Post) ProjectPost

func (p *Post) ProjectPost() *ProjectPost

ProjectPost converts the Post to ProjectPost

func (*Post) UserPost

func (p *Post) UserPost() *UserPost

UserPost converts the Post to a UserPost

type PostClassification

type PostClassification struct {
	ID    uint64 `igor:"primary_key"`
	UHpid uint64
	GHpid uint64
	Tag   string
}

PostClassification is the model for the relation posts_classifications

func (*PostClassification) GetTO

func (p *PostClassification) GetTO(users ...*User) *PostClassificationTO

GetTO returns its Transfer Object

func (PostClassification) TableName

func (PostClassification) TableName() string

TableName returns the table name associated with the structure

type PostClassificationTO

type PostClassificationTO struct {
	ID    uint64 `json:"id"`
	UHpid uint64 `json:"uHpid"`
	GHpid uint64 `json:"gHpid"`
	Tag   string `json:"tag"`
	// contains filtered or unexported fields
}

PostClassificationTO represents the TO of PostClassification

swagger:model

func (*PostClassificationTO) Original

func (to *PostClassificationTO) Original() *PostClassification

Original returns the original object of the TO

type PostTO

type PostTO struct {
	Hpid           uint64    `json:"hpid"`
	Pid            uint64    `json:"pid"`
	Message        string    `json:"message"`
	Time           time.Time `json:"time"`
	Lang           string    `json:"lang"`
	News           bool      `json:"news"`
	Closed         bool      `json:"closed"`
	FromInfo       *InfoTO   `json:"from"`
	ToInfo         *InfoTO   `json:"to"`
	Rate           int       `json:"rate"`
	RevisionsCount uint8     `json:"revisions"`
	CommentsCount  uint8     `json:"comments"`
	BookmarksCount uint8     `json:"bookmarkers"`
	LurkersCount   uint8     `json:"lurkers"`
	URL            string    `json:"url"`
	Timestamp      int64     `json:"timestamp"`
	Type           boardType `json:"type"`
	CanComment     bool      `json:"canComment"`
	CanBookmark    bool      `json:"canBookmark"`
	CanLurk        bool      `json:"canLurk"`
	CanEdit        bool      `json:"canEdit"`
	CanDelete      bool      `json:"canDelete"`
	// contains filtered or unexported fields
}

PostTO is the Transfor Object of Post. It represents the common fields presents in a Post

swagger:model

func (*PostTO) Original

func (to *PostTO) Original() *Post

Original returns the original object of the TO

type PostlistOptions

type PostlistOptions struct {
	Model      igor.DBModel // igor.DBModel used to apply filter (like language) to avoid conflics while doing joins
	Following  bool         // true -> show posts only FROM following
	Followers  bool         // true -> show posts only FROM followers
	Language   string       // if Language is a valid 2 characters identifier, show posts from users (users selected enabling/disabling following & folowers) speaking that Language
	N          uint8        // number of posts to return
	Older      uint64       // if specified, tells to the function using this struct to return N posts OLDER (created before) than the post with the specified "Older" ID
	OlderModel igor.DBModel // igor.DBModel required when the older identifier is fetched from a view
	Newer      uint64       // if specified, tells to the function using this struct to return N posts NEWER (created after) the post with the specified "Newer" ID
	NewerModel igor.DBModel // igor.DBModel required when the newer identifier is fetched from a view
}

PostlistOptions is used to specify the options for a list of posts. The 4 fields are documented and can be combined.

If Following = Followers = true -> show posts FROM user that I follow that follow me back (friends) If Older != 0 && Newer != 0 -> find posts BETWEEN this 2 posts

For example: - user.UserHome(&PostlistOptions{Followed: true, Language: "en"}) returns at most the last 20 posts from the english speaking users that I follow. - user.UserHome(&PostlistOptions{Followed: true, Following: true, Language: "it", Older: 90, Newer: 50, N: 10}) returns at most 10 posts, from user's friends, speaking italian, between the posts with hpid 90 and 50

type Profile

type Profile struct {
	Counter        uint64 `igor:"primary_key"`
	Website        string
	Quotes         string
	Biography      string
	Github         string
	Skype          string
	Jabber         string
	Yahoo          string
	Userscript     string
	Template       uint8
	MobileTemplate uint8
	Dateformat     string
	Facebook       string
	Twitter        string
	Steam          string
	Push           bool
	Pushregtime    time.Time `sql:"default:(now() at time zone 'utc')"`
	Closed         bool
}

Profile is the model for the relation profiles

func (Profile) TableName

func (Profile) TableName() string

TableName returns the table name associated with the structure

type ProfileTO

type ProfileTO struct {
	Counter        uint64    `json:"counter"`
	Website        string    `json:"website"`
	Quotes         []string  `json:"quotes"`
	Biography      string    `json:"biography"`
	Interests      []string  `json:"interests"`
	Github         string    `json:"github"`
	Skype          string    `json:"skype"`
	Jabber         string    `json:"jabber"`
	Yahoo          string    `json:"yahoo"`
	Userscript     string    `json:"userscript"`     // ?API?
	Template       uint8     `json:"template"`       // ?API?
	MobileTemplate uint8     `json:"mobileTemplate"` // ?API?
	Dateformat     string    `json:"dateformat"`     // ?API?
	Facebook       string    `json:"facebook"`
	Twitter        string    `json:"twitter"`
	Steam          string    `json:"steam"`
	Push           bool      `json:"push"`        // ?API?
	Pushregtime    time.Time `json:"pushregtime"` // ?API?
	Closed         bool      `json:"closed"`
	// contains filtered or unexported fields
}

ProfileTO represents the TO of Profile

swagger:model

func (*ProfileTO) Original

func (to *ProfileTO) Original() *Profile

Original returns the original object of the TO

type Project

type Project struct {
	Counter      uint64 `igor:"primary_key"`
	Description  string
	Name         string
	Private      bool
	Photo        sql.NullString
	Website      sql.NullString
	Goal         string
	Visible      bool
	Open         bool
	CreationTime time.Time `sql:"default:(now() at time zone 'utc')"`
}

Project is the model for the relation groups

func NewProject

func NewProject(id uint64) (*Project, error)

NewProject returns the user with the specified id

func NewProjectWhere

func NewProjectWhere(description *Project) (project *Project, e error)

NewProjectWhere returns the first user that matches the description

func Projects

func Projects(ids []uint64) []*Project

Projects returns a slice of pointer to Project, fetched from its Ids

func (*Project) Followers

func (prj *Project) Followers() []*User

Followers returns a []*User that follows the project

func (*Project) GetTO

func (p *Project) GetTO(users ...*User) *ProjectTO

GetTO returns its Transfer Object

func (*Project) ID

func (prj *Project) ID() uint64

ID returns the project ID

func (*Project) Info

func (prj *Project) Info() *Info

Info returns a *info struct

func (*Project) Language

func (prj *Project) Language() string

Language returns the project language

func (*Project) Members

func (prj *Project) Members() []*User

Members returns a slice of Users members of the project

func (*Project) NumericFollowers

func (prj *Project) NumericFollowers() (followers []uint64)

NumericFollowers returns a slice containing the IDs of users that followed this project

func (*Project) NumericMembers

func (prj *Project) NumericMembers() (members []uint64)

NumericMembers returns a slice containing the IDs of users that are member of this project

func (*Project) NumericOwner

func (prj *Project) NumericOwner() (owner uint64)

NumericOwner returns the Id of the owner of the project

func (*Project) Owner

func (prj *Project) Owner() (owner *User)

Owner returns the *User owner of the project

func (*Project) Postlist

func (prj *Project) Postlist(options PostlistOptions) *[]ExistingPost

Postlist returns the specified posts on the project

func (*Project) ProjectInfo

func (prj *Project) ProjectInfo() *ProjectInfo

ProjectInfo returns a ProjectInfo struct

func (Project) TableName

func (Project) TableName() string

TableName returns the table name associated with the structure

type ProjectFollower

type ProjectFollower struct {
	From     uint64
	To       uint64
	Time     time.Time `sql:"default:(now() at time zone 'utc')"`
	ToNotify bool
	Counter  uint64 `igor:"primary_key"`
}

ProjectFollower is the model for the relation groups_followers

func (*ProjectFollower) GetTO

func (p *ProjectFollower) GetTO(users ...*User) *ProjectFollowerTO

GetTO returns its Transfer Object

func (ProjectFollower) TableName

func (ProjectFollower) TableName() string

TableName returns the table name associated with the structure

type ProjectFollowerTO

type ProjectFollowerTO struct {
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	ToNotify  bool      `json:"toNotify"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

ProjectFollowerTO represents the TO of ProjectFollower

swagger:model

func (*ProjectFollowerTO) Original

func (to *ProjectFollowerTO) Original() *ProjectFollower

Original returns the original object of the TO

type ProjectInfo

type ProjectInfo struct {
	ID               uint64
	Owner            *User
	Members          []*User
	NumericMembers   []uint64
	Followers        []*User
	NumericFollowers []uint64
	Description      string
	Name             string
	Photo            *url.URL
	Website          *url.URL
	Goal             string
	Visible          bool
	Private          bool
	Open             bool
}

ProjectInfo is the struct that contains all the project's informations

type ProjectMember

type ProjectMember struct {
	From     uint64
	To       uint64
	Time     time.Time `sql:"default:(now() at time zone 'utc')"`
	ToNotify bool
	Counter  uint64 `igor:"primary_key"`
}

ProjectMember is the model for the relation groups_members

func (*ProjectMember) GetTO

func (m *ProjectMember) GetTO(users ...*User) *ProjectMemberTO

GetTO returns its Transfer Object

func (ProjectMember) TableName

func (ProjectMember) TableName() string

TableName returns the table name associated with the structure

type ProjectMemberTO

type ProjectMemberTO struct {
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	ToNotify  bool      `json:"toNotify"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

ProjectMemberTO represents the TO of ProjectMember

swagger:model

func (*ProjectMemberTO) Original

func (to *ProjectMemberTO) Original() *ProjectMember

Original returns the original object of the TO

type ProjectNotify

type ProjectNotify struct {
	From    uint64
	To      uint64
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Hpid    uint64
	Counter uint64 `igor:"primary_key"`
}

ProjectNotify is the model for the relation groups_notify

func (*ProjectNotify) GetTO

func (p *ProjectNotify) GetTO(users ...*User) *ProjectNotifyTO

GetTO returns its Transfer Object

func (ProjectNotify) TableName

func (ProjectNotify) TableName() string

TableName returns the table name associated with the structure

type ProjectNotifyTO

type ProjectNotifyTO struct {
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Hpid      uint64    `json:"hpid"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

ProjectNotifyTO represents the TO of ProjectNotify

swagger:model

func (*ProjectNotifyTO) Original

func (to *ProjectNotifyTO) Original() *ProjectNotify

Original returns the original object of the TO

type ProjectOwner

type ProjectOwner struct {
	From     uint64
	To       uint64
	Time     time.Time `sql:"default:(now() at time zone 'utc')"`
	ToNotify bool
	Counter  uint64 `igor:"primary_key"`
}

ProjectOwner is the model for the relation groups_owners

func (*ProjectOwner) GetTO

func (o *ProjectOwner) GetTO(users ...*User) *ProjectOwnerTO

GetTO returns its Transfer Object

func (ProjectOwner) TableName

func (ProjectOwner) TableName() string

TableName returns the table name associated with the structure

type ProjectOwnerTO

type ProjectOwnerTO struct {
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	ToNotify  bool      `json:"toNotify"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

ProjectOwnerTO represents the TO of ProjectOwner

swagger:model

func (*ProjectOwnerTO) Original

func (to *ProjectOwnerTO) Original() *ProjectOwner

Original returns the original object of the TO

type ProjectPost

type ProjectPost struct {
	Post
}

ProjectPost is the model for the relation groups_posts

func NewProjectPost

func NewProjectPost(hpid uint64) (*ProjectPost, error)

NewProjectPost initializes a ProjectPost struct

func NewProjectPostWhere

func NewProjectPostWhere(description *ProjectPost) (post *ProjectPost, e error)

NewProjectPostWhere returns the *ProjectPost fetching the first one that matches the description

func (*ProjectPost) Bookmarkers

func (post *ProjectPost) Bookmarkers() []*User

Bookmarks returns a slice of users that bookmarked the post

func (*ProjectPost) Bookmarks

func (post *ProjectPost) Bookmarks() *[]Bookmark

Bookmarks returns a pointer to a slice of Bookmark

func (*ProjectPost) BookmarksCount

func (post *ProjectPost) BookmarksCount() (count uint8)

BookmarksCount returns the number of users that bookmarked the post

func (*ProjectPost) ClearDefaults

func (post *ProjectPost) ClearDefaults()

ClearDefaults set to the go's default values the fields with default sql values

func (*ProjectPost) Comments

func (post *ProjectPost) Comments(options CommentlistOptions) *[]ExistingComment

Comments returns the full comments list, or the selected range of comments Comments(options) returns the comment list, using selected options

func (*ProjectPost) CommentsCount

func (post *ProjectPost) CommentsCount() (count uint8)

CommentsCount returns the number of comment's post

func (*ProjectPost) GetTO

func (p *ProjectPost) GetTO(users ...*User) *PostTO

GetTO returns its Transfer Object

func (*ProjectPost) ID

func (post *ProjectPost) ID() uint64

ID returns the Project Post ID

func (*ProjectPost) IsClosed

func (post *ProjectPost) IsClosed() bool

IsClosed reuturns ture if the post is closed

func (*ProjectPost) IsEditable

func (post *ProjectPost) IsEditable() bool

IsEditable returns true if the ProjectPost is editable

func (*ProjectPost) Language

func (post *ProjectPost) Language() string

Language returns the message language

func (*ProjectPost) Locks

func (post *ProjectPost) Locks() *[]Lock

Locks returns a pointer to a slice of Lock

func (*ProjectPost) Lurkers

func (post *ProjectPost) Lurkers() []*User

Lurkers returns a slice of users that are lurking the post

func (*ProjectPost) LurkersCount

func (post *ProjectPost) LurkersCount() (count uint8)

LurkersCount returns the number of users that are lurking the post

func (*ProjectPost) Lurks

func (post *ProjectPost) Lurks() *[]Lurk

Lurks returns a pointer to a slice of Lurk

func (*ProjectPost) NumericBookmarkers

func (post *ProjectPost) NumericBookmarkers() (bookmarkers []uint64)

NumericBookmarkers returns a slice of uint64 representing the ids of the users that bookmarked the post

func (*ProjectPost) NumericLurkers

func (post *ProjectPost) NumericLurkers() (lurkers []uint64)

NumericLurkers returns a slice of uint64 representing the ids of the users that lurked the post

func (*ProjectPost) NumericOwners

func (post *ProjectPost) NumericOwners() (ret []uint64)

NumericOwners returns a slice of ids of the owner of the posts (the ones that can perform actions)

func (*ProjectPost) NumericReference

func (post *ProjectPost) NumericReference() uint64

NumericReference returns the id of the recipient project

func (*ProjectPost) NumericSender

func (post *ProjectPost) NumericSender() uint64

NumericSender returns the id of the sender user

func (*ProjectPost) NumericType

func (*ProjectPost) NumericType() uint8

NumericType returns the numeric type of the post

func (*ProjectPost) Owners

func (post *ProjectPost) Owners() (ret []*User)

Owners returns a slice of *User representing the users who own the post

func (*ProjectPost) Reference

func (post *ProjectPost) Reference() Reference

Reference returns the recipient *Project

func (*ProjectPost) Revisions

func (post *ProjectPost) Revisions() (modifications []string)

Revisions returns all the revisions of the message

func (*ProjectPost) RevisionsNumber

func (post *ProjectPost) RevisionsNumber() (count uint8)

RevisionsNumber returns the number of the revisions

func (*ProjectPost) Sender

func (post *ProjectPost) Sender() *User

Sender returns the sender *User

func (*ProjectPost) SetLanguage

func (post *ProjectPost) SetLanguage(language string) error

SetLanguage set the language of the post

func (*ProjectPost) SetReference

func (post *ProjectPost) SetReference(id uint64)

SetReference set the destionation of the post. Project ID

func (*ProjectPost) SetSender

func (post *ProjectPost) SetSender(id uint64)

SetSender set the source of the post (the user ID)

func (*ProjectPost) SetText

func (post *ProjectPost) SetText(message string)

SetText set the text of the message

func (ProjectPost) TableName

func (ProjectPost) TableName() string

TableName returns the table name associated with the structure

func (*ProjectPost) Text

func (post *ProjectPost) Text() string

Text returns the post message

func (*ProjectPost) Type

func (*ProjectPost) Type() string

Type returns a string representing the post type

func (*ProjectPost) URL

func (post *ProjectPost) URL() *url.URL

URL returns the url of the post

func (*ProjectPost) Votes

func (post *ProjectPost) Votes() *[]Vote

Votes returns a pointer to a slice of Vote

func (*ProjectPost) VotesCount

func (post *ProjectPost) VotesCount() (sum int)

Votes returns the post's votes value

type ProjectPostBookmark

type ProjectPostBookmark struct {
	Hpid    uint64
	From    uint64
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter uint64    `igor:"primary_key"`
}

ProjectPostBookmark is the model for the relation groups_bookmarks

func (*ProjectPostBookmark) GetTO

func (b *ProjectPostBookmark) GetTO(users ...*User) *ProjectPostBookmarkTO

GetTO returns its Transfer Object

func (*ProjectPostBookmark) NumericReference

func (bookmark *ProjectPostBookmark) NumericReference() uint64

NumericReference returns the numeric ID of the reference

func (*ProjectPostBookmark) NumericSender

func (bookmark *ProjectPostBookmark) NumericSender() uint64

NumericSender returns the ID of the Sender

func (*ProjectPostBookmark) Reference

func (bookmark *ProjectPostBookmark) Reference() Reference

Reference returns the reference of the bookmark

func (*ProjectPostBookmark) Sender

func (bookmark *ProjectPostBookmark) Sender() (user *User)

Sender returns the User that casted the bookmark

func (ProjectPostBookmark) TableName

func (ProjectPostBookmark) TableName() string

TableName returns the table name associated with the structure

type ProjectPostBookmarkTO

type ProjectPostBookmarkTO struct {
	Hpid      uint64    `json:"hpid"`
	FromInfo  *InfoTO   `json:"from"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

ProjectPostBookmarkTO represents the TO of ProjectPostBookmark

swagger:model

func (*ProjectPostBookmarkTO) Original

Original returns the original object of the TO

type ProjectPostComment

type ProjectPostComment struct {
	Hcid     uint64 `igor:"primary_key"`
	Hpid     uint64
	From     uint64
	To       uint64
	Message  string
	Lang     string
	Time     time.Time `sql:"default:(now() at time zone 'utc')"`
	Editable bool      `sql:"default:true"`
}

ProjectPostComment is the model for the relation groups_comments

func NewProjectPostComment

func NewProjectPostComment(hcid uint64) (comment *ProjectPostComment, e error)

NewProjectPostComment initializes a ProjectPostComment struct

func NewProjectPostCommentWhere

func NewProjectPostCommentWhere(description *ProjectPostComment) (comment *ProjectPostComment, e error)

NewProjectPostCommentWhere returns the *ProjectPostComment fetching the first one that matches the description

func (*ProjectPostComment) ClearDefaults

func (comment *ProjectPostComment) ClearDefaults()

ClearDefaults set to the go's default values the fields with default sql values

func (*ProjectPostComment) GetTO

func (c *ProjectPostComment) GetTO(users ...*User) *ProjectPostCommentTO

GetTO returns its Transfer Object

func (*ProjectPostComment) ID

func (comment *ProjectPostComment) ID() uint64

ID returns the comment ID

func (*ProjectPostComment) IsEditable

func (comment *ProjectPostComment) IsEditable() bool

IsEditable returns true if the comment is editable

func (*ProjectPostComment) Language

func (comment *ProjectPostComment) Language() string

Language returns the message language

func (*ProjectPostComment) NumericOwners

func (comment *ProjectPostComment) NumericOwners() []uint64

NumericOwners returns a slice of ids of the owner of the comment (the ones that can perform actions)

func (*ProjectPostComment) NumericReference

func (comment *ProjectPostComment) NumericReference() uint64

NumericReference returns the id of the recipient Post

func (*ProjectPostComment) NumericSender

func (comment *ProjectPostComment) NumericSender() uint64

NumericSender returns the id of the sender user

func (*ProjectPostComment) Owners

func (comment *ProjectPostComment) Owners() []*User

Owners returns a slice of *User representing the users who own the comment

func (*ProjectPostComment) Post

func (comment *ProjectPostComment) Post() (ExistingPost, error)

Post returns the ExistingPost sturct to which the projectComment is related

func (*ProjectPostComment) Reference

func (comment *ProjectPostComment) Reference() Reference

Reference returns the recipient *ProjectPost

func (*ProjectPostComment) Revisions

func (comment *ProjectPostComment) Revisions() (modifications []string)

Revisions returns all the revisions of the message

func (*ProjectPostComment) RevisionsNumber

func (comment *ProjectPostComment) RevisionsNumber() (count uint8)

RevisionsNumber returns the number of the revisions

func (*ProjectPostComment) Sender

func (comment *ProjectPostComment) Sender() *User

Sender returns the sender *User

func (*ProjectPostComment) SetLanguage

func (comment *ProjectPostComment) SetLanguage(language string) error

SetLanguage set the language of the comment

func (*ProjectPostComment) SetReference

func (comment *ProjectPostComment) SetReference(hpid uint64)

SetReference set the destination of the comment

func (*ProjectPostComment) SetSender

func (comment *ProjectPostComment) SetSender(id uint64)

SetSender set the source of the comment (the user ID)

func (*ProjectPostComment) SetText

func (comment *ProjectPostComment) SetText(message string)

SetText set the text of the message

func (ProjectPostComment) TableName

func (ProjectPostComment) TableName() string

TableName returns the table name associated with the structure

func (*ProjectPostComment) Text

func (comment *ProjectPostComment) Text() string

Text returns the post message

func (*ProjectPostComment) Votes

func (comment *ProjectPostComment) Votes() *[]Vote

Votes returns a pointer to a slice of Vote

func (*ProjectPostComment) VotesCount

func (comment *ProjectPostComment) VotesCount() (sum int)

Votes returns the post's votes value

type ProjectPostCommentRevision

type ProjectPostCommentRevision struct {
	Hcid    uint64
	Message string
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	RevNo   uint16
	Counter uint64 `igor:"primary_key"`
}

ProjectPostCommentRevision is the model for the relation groups_comments_revisions

func (*ProjectPostCommentRevision) GetTO

GetTO returns its Transfer Object

func (ProjectPostCommentRevision) TableName

func (ProjectPostCommentRevision) TableName() string

TableName returns the table name associated with the structure

type ProjectPostCommentRevisionTO

type ProjectPostCommentRevisionTO struct {
	Hcid      uint64    `json:"hcid"`
	Message   string    `json:"message"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	RevNo     uint16    `json:"revNo"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

ProjectPostCommentRevisionTO represents the TO of ProjectPostCommentRevision

swagger:model

func (*ProjectPostCommentRevisionTO) Original

Original returns the original object of the TO

type ProjectPostCommentTO

type ProjectPostCommentTO struct {
	Hcid      uint64    `json:"hcid"`
	Hpid      uint64    `json:"hpid"`
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Message   string    `json:"message"`
	Lang      string    `json:"lang"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	CanEdit   bool      `json:"canEdit"`
	CanDelete bool      `json:"canDelete"`
	// contains filtered or unexported fields
}

ProjectPostCommentTO represents the TO of ProjectPostComment

swagger:model

func (*ProjectPostCommentTO) Original

func (to *ProjectPostCommentTO) Original() *ProjectPostComment

Original returns the original object of the TO

type ProjectPostCommentVote

type ProjectPostCommentVote struct {
	Hcid    uint64
	From    uint64
	To      uint64
	Vote    int8
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter uint64    `igor:"primary_key"`
}

ProjectPostCommentVote is the model for the relation groups_comment_thumbs

func (*ProjectPostCommentVote) GetTO

GetTO returns its Transfer Object

func (*ProjectPostCommentVote) NumericReference

func (vote *ProjectPostCommentVote) NumericReference() uint64

NumericReference returns the numeric ID of the reference

func (*ProjectPostCommentVote) NumericSender

func (vote *ProjectPostCommentVote) NumericSender() uint64

NumericSender returns the ID of the Sender

func (*ProjectPostCommentVote) Reference

func (vote *ProjectPostCommentVote) Reference() Reference

Reference returns the reference of the vote

func (*ProjectPostCommentVote) Sender

func (vote *ProjectPostCommentVote) Sender() (user *User)

Sender returns the User that casted the vote

func (ProjectPostCommentVote) TableName

func (ProjectPostCommentVote) TableName() string

TableName returns the table name associated with the structure

func (*ProjectPostCommentVote) Value

func (vote *ProjectPostCommentVote) Value() int8

Value returns the vote's value

type ProjectPostCommentVoteTO

type ProjectPostCommentVoteTO struct {
	Hcid      uint64    `json:"hcid"`
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Vote      int8      `json:"vote"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

ProjectPostCommentVoteTO represents the TO of ProjectPostCommentVote

swagger:model

func (*ProjectPostCommentVoteTO) Original

Original returns the original object of the TO

type ProjectPostCommentsNotify

type ProjectPostCommentsNotify struct {
	From    uint64
	To      uint64
	Hpid    uint64
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter uint64    `igor:"primary_key"`
}

ProjectPostCommentsNotify is the model for the relation groups_comments_notify

func (*ProjectPostCommentsNotify) GetTO

GetTO returns its Transfer Object

func (ProjectPostCommentsNotify) TableName

func (ProjectPostCommentsNotify) TableName() string

TableName returns the table name associated with the structure

type ProjectPostCommentsNotifyTO

type ProjectPostCommentsNotifyTO struct {
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Hpid      uint64    `json:"hpid"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

ProjectPostCommentsNotifyTO represents the TO of ProjectPostCommentsNotify

swagger:model

func (*ProjectPostCommentsNotifyTO) Original

Original returns the original object of the TO

type ProjectPostLock

type ProjectPostLock struct {
	User    uint64
	Hpid    uint64
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter uint64    `igor:"primary_key"`
}

ProjectPostLock is the model for the relation groups_posts_no_notify

func (*ProjectPostLock) GetTO

func (p *ProjectPostLock) GetTO(users ...*User) *ProjectPostLockTO

GetTO returns its Transfer Object

func (*ProjectPostLock) NumericReference

func (lock *ProjectPostLock) NumericReference() uint64

NumericReference returns the numeric ID of the reference

func (*ProjectPostLock) NumericSender

func (lock *ProjectPostLock) NumericSender() uint64

NumericSender returns the ID of the Sender

func (*ProjectPostLock) Reference

func (lock *ProjectPostLock) Reference() Reference

Reference returns the reference of the lurk

func (*ProjectPostLock) Sender

func (lock *ProjectPostLock) Sender() (user *User)

Sender returns the User that casted the lock

func (ProjectPostLock) TableName

func (ProjectPostLock) TableName() string

TableName returns the table name associated with the structure

type ProjectPostLockTO

type ProjectPostLockTO struct {
	User      *InfoTO   `json:"user"`
	Hpid      uint64    `json:"hpid"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

ProjectPostLockTO represents the TO of ProjectPostLock

swagger:model

func (*ProjectPostLockTO) Original

func (to *ProjectPostLockTO) Original() *ProjectPostLock

Original returns the original object of the TO

type ProjectPostLurk

type ProjectPostLurk struct {
	Hpid    uint64
	From    uint64
	To      uint64
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter uint64    `igor:"primary_key"`
}

ProjectPostLurk is the model for the relation groups_lurkers

func (*ProjectPostLurk) GetTO

func (l *ProjectPostLurk) GetTO(users ...*User) *ProjectPostLurkTO

GetTO returns its Transfer Object

func (*ProjectPostLurk) NumericReference

func (lurk *ProjectPostLurk) NumericReference() uint64

NumericReference returns the numeric ID of the reference

func (*ProjectPostLurk) NumericSender

func (lurk *ProjectPostLurk) NumericSender() uint64

NumericSender returns the ID of the Sender

func (*ProjectPostLurk) Reference

func (lurk *ProjectPostLurk) Reference() Reference

Reference returns the reference of the lurk

func (*ProjectPostLurk) Sender

func (lurk *ProjectPostLurk) Sender() (user *User)

Sender returns the User that casted the lurk

func (ProjectPostLurk) TableName

func (ProjectPostLurk) TableName() string

TableName returns the table name associated with the structure

type ProjectPostLurkTO

type ProjectPostLurkTO struct {
	Hpid      uint64    `json:"hpid"`
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

ProjectPostLurkTO represents the TO of ProjectPostLurk

swagger:model

func (*ProjectPostLurkTO) Original

func (to *ProjectPostLurkTO) Original() *ProjectPostLurk

Original returns the original object of the TO

type ProjectPostRevision

type ProjectPostRevision struct {
	Hpid    uint64
	Message string
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	RevNo   uint16
	Counter uint64 `igor:"primary_key"`
}

ProjectPostRevision is the model for the relation groups_posts_revisions

func (*ProjectPostRevision) GetTO

func (p *ProjectPostRevision) GetTO(users ...*User) *ProjectPostRevisionTO

GetTO returns its Transfer Object

func (ProjectPostRevision) TableName

func (ProjectPostRevision) TableName() string

TableName returns the table name associated with the structure

type ProjectPostRevisionTO

type ProjectPostRevisionTO struct {
	Hpid      uint64    `json:"hpid"`
	Message   string    `json:"message"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	RevNo     uint16    `json:"revNo"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

ProjectPostRevisionTO represents the TO of ProjectPostRevision

swagger:model

func (*ProjectPostRevisionTO) Original

Original returns the original object of the TO

type ProjectPostUserLock

type ProjectPostUserLock struct {
	From    uint64
	To      uint64
	Hpid    uint64
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter uint64    `igor:"primary_key"`
}

ProjectPostUserLock is the model for the relation groups_comments_no_notify

func (*ProjectPostUserLock) GetTO

func (p *ProjectPostUserLock) GetTO(users ...*User) *ProjectPostUserLockTO

GetTO returns its Transfer Object

func (*ProjectPostUserLock) NumericReference

func (lock *ProjectPostUserLock) NumericReference() uint64

NumericReference returns the numeric ID of the reference

func (*ProjectPostUserLock) NumericSender

func (lock *ProjectPostUserLock) NumericSender() uint64

NumericSender returns the ID of the Sender

func (*ProjectPostUserLock) Reference

func (lock *ProjectPostUserLock) Reference() Reference

Reference returns the reference of the lurk

func (*ProjectPostUserLock) Sender

func (lock *ProjectPostUserLock) Sender() (user *User)

Sender returns the User that casted the lock

func (ProjectPostUserLock) TableName

func (ProjectPostUserLock) TableName() string

TableName returns the table name associated with the structure

type ProjectPostUserLockTO

type ProjectPostUserLockTO struct {
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Hpid      uint64    `json:"hpid"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

ProjectPostUserLockTO represents the TO of ProjectPostUserLock

swagger:model

func (*ProjectPostUserLockTO) Original

Original returns the original object of the TO

type ProjectPostVote

type ProjectPostVote struct {
	Hpid    uint64
	From    uint64
	To      uint64
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Vote    int8
	Counter uint64 `igor:"primary_key"`
}

ProjectPostVote is the model for the relation groups_thumbs

func (*ProjectPostVote) GetTO

func (t *ProjectPostVote) GetTO(users ...*User) *ProjectPostVoteTO

GetTO returns its Transfer Object

func (*ProjectPostVote) NumericReference

func (vote *ProjectPostVote) NumericReference() uint64

NumericReference returns the numeric ID of the reference

func (*ProjectPostVote) NumericSender

func (vote *ProjectPostVote) NumericSender() uint64

NumericSender returns the ID of the Sender

func (*ProjectPostVote) Reference

func (vote *ProjectPostVote) Reference() Reference

Reference returns the reference of the vote

func (*ProjectPostVote) Sender

func (vote *ProjectPostVote) Sender() (user *User)

Sender returns the User that casted the vote

func (ProjectPostVote) TableName

func (ProjectPostVote) TableName() string

TableName returns the table name associated with the structure

func (*ProjectPostVote) Value

func (vote *ProjectPostVote) Value() int8

Value returns the vote's value

type ProjectPostVoteTO

type ProjectPostVoteTO struct {
	Hpid      uint64    `json:"hpid"`
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Vote      int8      `json:"vote"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

ProjectPostVoteTO represents the TO of ProjectPostVote

swagger:model

func (*ProjectPostVoteTO) Original

func (to *ProjectPostVoteTO) Original() *ProjectPostVote

Original returns the original object of the TO

type ProjectTO

type ProjectTO struct {
	Counter      uint64         `json:"counter"`
	Description  string         `json:"description"`
	Name         string         `json:"name"`
	Private      bool           `json:"private"`
	Photo        sql.NullString `json:"photo"`
	Website      sql.NullString `json:"website"`
	Goal         string         `json:"goal"`
	Visible      bool           `json:"visible"`
	Open         bool           `json:"open"`
	CreationTime time.Time      `json:"creationTime"`
	// contains filtered or unexported fields
}

ProjectTO represents the TO of Project

swagger:model

func (*ProjectTO) Original

func (to *ProjectTO) Original() *Project

Original returns the original object of the TO

type Reference

type Reference interface {
	ID() uint64
	Language() string
}

Reference represents a reference. A comment refers to a user/project post A post, refers to a user/project board

type SpecialProject

type SpecialProject struct {
	Role    string `igor:"primary_key"`
	Counter uint64
}

SpecialProject is the model for the relation special_groups

func (*SpecialProject) GetTO

func (p *SpecialProject) GetTO(users ...*User) *SpecialProjectTO

GetTO returns its Transfer Object

func (SpecialProject) TableName

func (SpecialProject) TableName() string

TableName returns the table name associated with the structure

type SpecialProjectTO

type SpecialProjectTO struct {
	Role    string `json:"role"`
	Counter uint64 `json:"counter"`
	// contains filtered or unexported fields
}

SpecialProjectTO represents the TO of SpecialProject

swagger:model

func (*SpecialProjectTO) Original

func (to *SpecialProjectTO) Original() *SpecialProject

Original returns the original object of the TO

type SpecialUser

type SpecialUser struct {
	Role    string `igor:"primary_key"`
	Counter uint64
}

SpecialUser is the model for the relation special_users

func (*SpecialUser) GetTO

func (u *SpecialUser) GetTO(users ...*User) *SpecialUserTO

GetTO returns its Transfer Object

func (SpecialUser) TableName

func (SpecialUser) TableName() string

TableName returns the table name associated with the structure

type SpecialUserTO

type SpecialUserTO struct {
	Role    string `json:"role"`
	Counter uint64 `json:"counter"`
	// contains filtered or unexported fields
}

SpecialUserTO represents the TO of SpecialUser

swagger:model

func (*SpecialUserTO) Original

func (to *SpecialUserTO) Original() *SpecialUser

Original returns the original object of the TO

type Template

type Template struct {
	Number uint8
	Name   string
}

Template is the representation of a nerdz website template

type Transferable

type Transferable interface {
	// GetTO returns a proper data structure for the API
	// users (max len 1) is the current user viewing the API (the one who grants
	// the proprer access to the client application)
	// Is optional because not all the TO are different (ore have different content)
	// if the user is a specific user
	GetTO(users ...*User) interface{}
}

Transferable represents a common interface for all the types defined by the backend that are able to generate a data structure that can be returned by the API

type User

type User struct {
	Counter          uint64    `igor:"primary_key"`
	Last             time.Time `sql:"default:(now() at time zone 'utc')"`
	NotifyStory      igor.JSON `sql:"default:'{}'::jsonb"`
	Private          bool
	Lang             string
	Username         string
	Password         string
	RemoteAddr       string
	HTTPUserAgent    string `igor:"column:http_user_agent"`
	Email            string
	Name             string
	Surname          string
	Gender           bool
	BirthDate        time.Time `sql:"default:(now() at time zone 'utc')"`
	BoardLang        string
	Timezone         string
	Viewonline       bool
	RegistrationTime time.Time `sql:"default:(now() at time zone 'utc')"`
	// Relation. Manually fill the field when required
	Profile Profile `sql:"-"`
}

User is the model for the relation users

func Login

func Login(login, password string) (*User, error)

Login initializes a User struct if login (id | email | username) and password are correct

func NewUser

func NewUser(id uint64) (*User, error)

NewUser returns the user with the specified id

func NewUserWhere

func NewUserWhere(description *User) (user *User, e error)

NewUserWhere returns the first user that matches the description

func Users

func Users(ids []uint64) []*User

Users returns a slice of pointer to User, fetched from its Ids

func (*User) Add

func (user *User) Add(message newMessage) error

Add a newMessage

func (*User) AddInterest

func (user *User) AddInterest(interest *Interest) error

AddInterest adds the specified interest. An error is returned if the interests already exists or some DBMS contraint is violated

func (*User) Blacklist

func (user *User) Blacklist() []*User

Blacklist returns a slice of users that user (*Project) put in his blacklist

func (*User) BlacklistUser

func (user *User) BlacklistUser(other *User, motivation string) error

BlacklistUser add other user to the user blacklist

func (*User) Blacklisting

func (user *User) Blacklisting() []*User

Blacklisting returns a slice of users that puts user (*User) in their blacklist

func (*User) BoardInfo

func (user *User) BoardInfo() *BoardInfo

BoardInfo returns a *BoardInfo struct

func (*User) Bookmark

func (user *User) Bookmark(post ExistingPost) (Bookmark, error)

Bookmark bookmarks the specified post by a specific user. An error is returned if the post isn't defined or if there are other errors returned by the DBMS

func (*User) CanBookmark

func (user *User) CanBookmark(message ExistingPost) bool

CanBookmark returns true if user haven't bookamrked to existingPost yet

func (*User) CanComment

func (user *User) CanComment(message ExistingPost) bool

CanComment returns true if the user can comment to the existingPost

func (*User) CanDelete

func (user *User) CanDelete(message existingMessage) bool

CanDelete returns true if user can delete the existingMessage

func (*User) CanEdit

func (user *User) CanEdit(message editingMessage) bool

CanEdit returns true if user can edit the editingMessage

func (*User) CanLurk

func (user *User) CanLurk(message ExistingPost) bool

CanLurk returns true if the user haven't lurked the existingPost yet

func (*User) CanSee

func (user *User) CanSee(board Board) bool

CanSee returns true if the user can see the Board content

func (*User) ContactInfo

func (user *User) ContactInfo() *ContactInfo

ContactInfo returns a *ContactInfo struct

func (*User) Conversations

func (user *User) Conversations() (*[]Conversation, error)

Conversations returns all the private conversations done by the user

func (*User) Delete

func (user *User) Delete(message existingMessage) error

Delete an existing message

func (*User) DeleteConversation

func (user *User) DeleteConversation(other uint64) error

DeleteConversation deletes the conversation of user with other user

func (*User) DeleteInterest

func (user *User) DeleteInterest(interest *Interest) error

DeleteInterest removes the specified interest (by its ID or its Value).

func (*User) Edit

func (user *User) Edit(message editingMessage) error

Edit an existing message

func (*User) Follow

func (user *User) Follow(board Board) error

Follow creates a new "follow" relationship between the current user and another NERDZ board. The board could represent a NERDZ's project or another NERDZ's user.

func (*User) Followers

func (user *User) Followers() []*User

Followers returns a slice of User that are user's followers

func (*User) Friends

func (user *User) Friends() []*User

Friends returns the current user's friends

func (*User) GetTO

func (u *User) GetTO(users ...*User) *UserTO

GetTO returns its Transfer Object: *User GetTO embeds *Profile GetTO

func (*User) Home

func (user *User) Home(options PostlistOptions) *[]Message

Home returns a slice of Post representing the user home. Posts are filtered by specified options.

func (*User) ID

func (user *User) ID() uint64

ID returns the user ID

func (*User) Info

func (user *User) Info() *Info

Info returns a *info struct

func (*User) Interests

func (user *User) Interests() (interests []string)

Interests returns a []string of user interests

func (*User) Language

func (user *User) Language() string

Language returns the user language

func (*User) Lock

func (user *User) Lock(post ExistingPost, users ...*User) (*[]Lock, error)

Lock lockes the specified post. If users are present, indiidual notifications are disabled from the user presents in the users list.

func (*User) Lurk

func (user *User) Lurk(post ExistingPost) (Lurk, error)

Lurk lurkes the specified post by a specific user. An error is returned if the post isn't defined or if there are other errors returned by the DBMS

func (*User) NumericBlacklist

func (user *User) NumericBlacklist() (blacklist []uint64)

NumericBlacklist returns a slice containing the counters (IDs) of blacklisted user

func (*User) NumericBlacklisting

func (user *User) NumericBlacklisting() (blacklist []uint64)

NumericBlacklisting returns a slice containing the IDs of users that puts user (*User) in their blacklist

func (*User) NumericFollowers

func (user *User) NumericFollowers() (followers []uint64)

NumericFollowers returns a slice containing the IDs of User that are user's followers

func (*User) NumericFriends

func (user *User) NumericFriends() (friends []uint64)

NumericFriends returns a slice containing the IDs of Users that are user's friends (follows each other)

func (*User) NumericProjectFollowing

func (user *User) NumericProjectFollowing() (following []uint64)

NumericProjectFollowing returns a slice containing the IDs of Project that user (User *) is following

func (*User) NumericProjects

func (user *User) NumericProjects() (projects []uint64)

NumericProjects returns a slice containing the IDs of the projects owned by user

func (*User) NumericUserFollowing

func (user *User) NumericUserFollowing() (following []uint64)

NumericUserFollowing returns a slice containing the IDs of User that user (User *) is following

func (*User) NumericWhitelist

func (user *User) NumericWhitelist() []uint64

NumericWhitelist returns a slice containing the IDs of users that are in user whitelist

func (*User) NumericWhitelisting

func (user *User) NumericWhitelisting() (whitelisting []uint64)

NumericWhitelisting returns a slice containing thr IDs of users that whitelisted the user

func (*User) PersonalInfo

func (user *User) PersonalInfo() *PersonalInfo

PersonalInfo returns a *PersonalInfo struct

func (*User) Pms

func (user *User) Pms(otherUser uint64, options PmsOptions) (*[]Pm, error)

Pms returns a slice of Pm, representing the list of the last messages exchanged with other users

func (*User) Postlist

func (user *User) Postlist(options PostlistOptions) *[]ExistingPost

Postlist returns the specified slice of post on the user board

func (*User) ProjectFollowing

func (user *User) ProjectFollowing() []*Project

ProjectFollowing returns a slice of Project that user (User *) is following

func (*User) ProjectHome

func (user *User) ProjectHome(options PostlistOptions) *[]ProjectPost

ProjectHome returns a slice of ProjectPost selected by options

func (*User) Projects

func (user *User) Projects() []*Project

Projects returns a slice of projects owned by the user

func (User) TableName

func (User) TableName() string

TableName returns the table name associated with the structure

func (*User) UnblacklistUser

func (user *User) UnblacklistUser(other *User) error

UnblacklistUser removes other user to the user blacklist

func (*User) Unbookmark

func (user *User) Unbookmark(post ExistingPost) error

Unbookmark the specified post by a specific user. An error is returned if the post isn't defined or if there are other errors returned by the DBMS

func (*User) Unfollow

func (user *User) Unfollow(board Board) error

Unfollow delete a "follow" relationship between the current user and another NERDZ board. The board could represent a NERDZ's project or another NERDZ's user.

func (*User) Unlock

func (user *User) Unlock(post ExistingPost, users ...*User) error

Unlock the specified post by a specific user. An error is returned if the post isn't defined or if there are other errors returned by the DBMS

func (*User) Unlurk

func (user *User) Unlurk(post ExistingPost) error

Unlurk the specified post by a specific user. An error is returned if the post isn't defined or if there are other errors returned by the DBMS

func (*User) UnwhitelistUser

func (user *User) UnwhitelistUser(other *User) error

UnwhitelistUser removes other user to the user whitelist

func (*User) UserFollowing

func (user *User) UserFollowing() []*User

UserFollowing returns a slice of User that user (User *) is following

func (*User) UserHome

func (user *User) UserHome(options PostlistOptions) *[]UserPost

UserHome returns a slice of UserPost specified by options

func (*User) Vote

func (user *User) Vote(message existingMessage, vote int8) (Vote, error)

Vote express a positive/negative preference for a post or comment. Returns the vote if everything went ok

func (*User) Whitelist

func (user *User) Whitelist() []*User

Whitelist returns a slice of users that are in the user whitelist

func (*User) WhitelistUser

func (user *User) WhitelistUser(other *User) error

WhitelistUser add other user to the user whitelist

func (*User) Whitelisting

func (user *User) Whitelisting() []*User

Whitelisting returns a slice of users that whitelisted the user

type UserFollower

type UserFollower struct {
	From     uint64
	To       uint64
	Time     time.Time `sql:"default:(now() at time zone 'utc')"`
	ToNotify bool
	Counter  uint64 `igor:"primary_key"`
}

UserFollower is the model for the relation followers

func (*UserFollower) GetTO

func (u *UserFollower) GetTO(users ...*User) *UserFollowerTO

GetTO returns its Transfer Object

func (UserFollower) TableName

func (UserFollower) TableName() string

TableName returns the table name associated with the structure

type UserFollowerTO

type UserFollowerTO struct {
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	ToNotify  bool      `json:"toNotify"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

UserFollowerTO represents the TO of UserFollower

swagger:model

func (*UserFollowerTO) Original

func (to *UserFollowerTO) Original() *UserFollower

Original returns the original object of the TO

type UserPost

type UserPost struct {
	Post
}

UserPost is the model for the relation posts

func NewUserPost

func NewUserPost(hpid uint64) (*UserPost, error)

NewUserPost returns the *UserPost with id hpid if exists. Returns error otherwise

func NewUserPostWhere

func NewUserPostWhere(description *UserPost) (post *UserPost, e error)

NewUserPostWhere returns the *UserPost fetching the first one that matches the description

func (*UserPost) Bookmarkers

func (post *UserPost) Bookmarkers() []*User

Bookmarks returns a slice of users that bookmarked the post

func (*UserPost) Bookmarks

func (post *UserPost) Bookmarks() *[]Bookmark

Bookmarks returns a pointer to a slice of Bookmark

func (*UserPost) BookmarksCount

func (post *UserPost) BookmarksCount() (count uint8)

BookmarksCount returns the number of users that bookmarked the post

func (*UserPost) ClearDefaults

func (post *UserPost) ClearDefaults()

ClearDefaults set to the go's default values the fields with default sql values

func (*UserPost) Comments

func (post *UserPost) Comments(options CommentlistOptions) *[]ExistingComment

Comments returns the full comments list, or the selected range of comments Comments(options) returns the comment list, using selected options

func (*UserPost) CommentsCount

func (post *UserPost) CommentsCount() (count uint8)

CommentsCount returns the number of comment's post

func (*UserPost) GetTO

func (p *UserPost) GetTO(users ...*User) *PostTO

GetTO returns its Transfer Object

func (*UserPost) ID

func (post *UserPost) ID() uint64

ID returns the User Post ID

func (*UserPost) IsClosed

func (post *UserPost) IsClosed() bool

IsClosed reuturns ture if the post is closed

func (*UserPost) IsEditable

func (post *UserPost) IsEditable() bool

IsEditable returns true if the post is editable

func (*UserPost) Language

func (post *UserPost) Language() string

Language returns the message language

func (*UserPost) Locks

func (post *UserPost) Locks() *[]Lock

Locks returns a pointer to a slice of Lock

func (*UserPost) Lurkers

func (post *UserPost) Lurkers() []*User

Lurkers returns a slice of users that are lurking the post

func (*UserPost) LurkersCount

func (post *UserPost) LurkersCount() (count uint8)

LurkersCount returns the number of users that are lurking the post

func (*UserPost) Lurks

func (post *UserPost) Lurks() *[]Lurk

Lurks returns a pointer to a slice of Lurk

func (*UserPost) NumericBookmarkers

func (post *UserPost) NumericBookmarkers() (bookmarkers []uint64)

NumericBookmarkers returns a slice of uint64 representing the ids of the users that bookmarked the post

func (*UserPost) NumericLurkers

func (post *UserPost) NumericLurkers() (lurkers []uint64)

NumericLurkers returns a slice of uint64 representing the ids of the users that lurked the post

func (*UserPost) NumericOwners

func (post *UserPost) NumericOwners() []uint64

NumericOwners returns a slice of ids of the owner of the posts (the ones that can perform actions)

func (*UserPost) NumericReference

func (post *UserPost) NumericReference() uint64

NumericReference returns the id of the recipient user

func (*UserPost) NumericSender

func (post *UserPost) NumericSender() uint64

NumericSender returns the id of the sender user

func (*UserPost) NumericType

func (*UserPost) NumericType() uint8

NumericType returns the numeric type of the post

func (*UserPost) Owners

func (post *UserPost) Owners() (ret []*User)

Owners returns a slice of *User representing the users who own the post

func (*UserPost) Reference

func (post *UserPost) Reference() Reference

Reference returns the recipient *User

func (*UserPost) Revisions

func (post *UserPost) Revisions() (modifications []string)

Revisions returns all the revisions of the message

func (*UserPost) RevisionsNumber

func (post *UserPost) RevisionsNumber() (count uint8)

RevisionsNumber returns the number of the revisions

func (*UserPost) Sender

func (post *UserPost) Sender() *User

Sender returns the sender *User

func (*UserPost) SetLanguage

func (post *UserPost) SetLanguage(language string) error

SetLanguage set the language of the post

func (*UserPost) SetReference

func (post *UserPost) SetReference(id uint64)

SetReference sets the destionation of the post: user ID

func (*UserPost) SetSender

func (post *UserPost) SetSender(id uint64)

SetSender sets the source of the post (the user ID)

func (*UserPost) SetText

func (post *UserPost) SetText(message string)

SetText set the text of the message

func (UserPost) TableName

func (UserPost) TableName() string

TableName returns the table name associated with the structure

func (*UserPost) Text

func (post *UserPost) Text() string

Text returns the post message

func (*UserPost) Type

func (*UserPost) Type() string

Type returns a string representing the post type

func (*UserPost) URL

func (post *UserPost) URL() *url.URL

URL returns the url of the post

func (*UserPost) Votes

func (post *UserPost) Votes() *[]Vote

Votes returns a pointer to a slice of Vote

func (*UserPost) VotesCount

func (post *UserPost) VotesCount() (sum int)

Votes returns the post's votes value

type UserPostBookmark

type UserPostBookmark struct {
	Hpid    uint64
	From    uint64
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter uint64    `igor:"primary_key"`
}

UserPostBookmark is the model for the relation bookmarks

func (*UserPostBookmark) GetTO

func (b *UserPostBookmark) GetTO(users ...*User) *UserPostBookmarkTO

GetTO returns its Transfer Object

func (*UserPostBookmark) NumericReference

func (bookmark *UserPostBookmark) NumericReference() uint64

NumericReference returns the numeric ID of the reference

func (*UserPostBookmark) NumericSender

func (bookmark *UserPostBookmark) NumericSender() uint64

NumericSender returns the ID of the Sender

func (*UserPostBookmark) Reference

func (bookmark *UserPostBookmark) Reference() Reference

Reference returns the reference of the bookmark

func (*UserPostBookmark) Sender

func (bookmark *UserPostBookmark) Sender() (user *User)

Sender returns the User that casted the bookmark

func (UserPostBookmark) TableName

func (UserPostBookmark) TableName() string

TableName returns the table name associated with the structure

type UserPostBookmarkTO

type UserPostBookmarkTO struct {
	Hpid      uint64    `json:"hpid"`
	FromInfo  *InfoTO   `json:"from"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

UserPostBookmarkTO represents the TO of UserPostBookmark

swagger:model

func (*UserPostBookmarkTO) Original

func (to *UserPostBookmarkTO) Original() *UserPostBookmark

Original returns the original object of the TO

type UserPostComment

type UserPostComment struct {
	Hcid     uint64 `igor:"primary_key"`
	Hpid     uint64
	From     uint64
	To       uint64
	Message  string
	Lang     string
	Time     time.Time `sql:"default:(now() at time zone 'utc')"`
	Editable bool      `sql:"default:true"`
}

UserPostComment is the model for the relation comments

func NewUserPostComment

func NewUserPostComment(hcid uint64) (comment *UserPostComment, e error)

NewUserPostComment initializes a UserPostComment struct

func NewUserPostCommentWhere

func NewUserPostCommentWhere(description *UserPostComment) (comment *UserPostComment, e error)

NewUserPostCommentWhere returns the *UserPostComment fetching the first one that matches the description

func (*UserPostComment) ClearDefaults

func (comment *UserPostComment) ClearDefaults()

ClearDefaults set to the go's default values the fields with default sql values

func (*UserPostComment) GetTO

func (c *UserPostComment) GetTO(users ...*User) *UserPostCommentTO

GetTO returns its Transfer Object

func (*UserPostComment) ID

func (comment *UserPostComment) ID() uint64

ID returns the UserPostComment ID

func (*UserPostComment) IsEditable

func (comment *UserPostComment) IsEditable() bool

IsEditable returns true if the comment is editable

func (*UserPostComment) Language

func (comment *UserPostComment) Language() string

Language returns the message language

func (*UserPostComment) NumericOwners

func (comment *UserPostComment) NumericOwners() []uint64

NumericOwners returns a slice of ids of the owner of the comment (the ones that can perform actions)

func (*UserPostComment) NumericReference

func (comment *UserPostComment) NumericReference() uint64

NumericReference returns the id of the recipient Post

func (*UserPostComment) NumericSender

func (comment *UserPostComment) NumericSender() uint64

NumericSender returns the id of the sender user

func (*UserPostComment) Owners

func (comment *UserPostComment) Owners() []*User

Owners returns a slice of *User representing the users who own the comment

func (*UserPostComment) Post

func (comment *UserPostComment) Post() (ExistingPost, error)

Post returns the ExistingPost struct to which the comment is related

func (*UserPostComment) Reference

func (comment *UserPostComment) Reference() Reference

Reference returns the recipient *Post

func (*UserPostComment) Revisions

func (comment *UserPostComment) Revisions() (modifications []string)

Revisions returns all the revisions of the message

func (*UserPostComment) RevisionsNumber

func (comment *UserPostComment) RevisionsNumber() (count uint8)

RevisionsNumber returns the number of the revisions

func (*UserPostComment) Sender

func (comment *UserPostComment) Sender() *User

Sender returns the sender *User

func (*UserPostComment) SetLanguage

func (comment *UserPostComment) SetLanguage(language string) error

SetLanguage set the language of the comment

func (*UserPostComment) SetReference

func (comment *UserPostComment) SetReference(id uint64)

SetReference sets the destination of the comment (the post ID)

func (*UserPostComment) SetSender

func (comment *UserPostComment) SetSender(id uint64)

SetSender sets the source of the comment (the user ID)

func (*UserPostComment) SetText

func (comment *UserPostComment) SetText(message string)

SetText set the text of the message

func (UserPostComment) TableName

func (UserPostComment) TableName() string

TableName returns the table name associated with the structure

func (*UserPostComment) Text

func (comment *UserPostComment) Text() string

Text returns the post message

func (*UserPostComment) Votes

func (comment *UserPostComment) Votes() *[]Vote

Votes returns a pointer to a slice of Vote

func (*UserPostComment) VotesCount

func (comment *UserPostComment) VotesCount() (sum int)

Votes returns the post's votes value

type UserPostCommentRevision

type UserPostCommentRevision struct {
	Hcid    uint64
	Message string
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	RevNo   int8
	Counter uint64 `igor:"primary_key"`
}

UserPostCommentRevision is the model for the relation comments_revisions

func (*UserPostCommentRevision) GetTO

GetTO returns its Transfer Object

func (UserPostCommentRevision) TableName

func (UserPostCommentRevision) TableName() string

TableName returns the table name associated with the structure

type UserPostCommentRevisionTO

type UserPostCommentRevisionTO struct {
	Hcid      uint64    `json:"hcid"`
	Message   string    `json:"message"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	RevNo     int8      `json:"revNo"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

UserPostCommentRevisionTO represents the TO of UserPostCommentRevision

swagger:model

func (*UserPostCommentRevisionTO) Original

Original returns the original object of the TO

type UserPostCommentTO

type UserPostCommentTO struct {
	Hcid      uint64    `json:"hcid"`
	Hpid      uint64    `json:"hpid"`
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Message   string    `json:"message"`
	Lang      string    `json:"lang"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	CanEdit   bool      `json:"canEdit"`
	CanDelete bool      `json:"canDelete"`
	// contains filtered or unexported fields
}

UserPostCommentTO represents the TO of UserPostComment

swagger:model

func (*UserPostCommentTO) Original

func (to *UserPostCommentTO) Original() *UserPostComment

Original returns the original object of the TO

type UserPostCommentVote

type UserPostCommentVote struct {
	Hcid    uint64
	From    uint64
	Vote    int8
	Counter uint64 `igor:"primary_key"`
}

UserPostCommentVote is the model for the relation groups_comment_thumbs

func (*UserPostCommentVote) GetTO

func (t *UserPostCommentVote) GetTO(users ...*User) *UserPostCommentVoteTO

GetTO returns its Transfer Object

func (*UserPostCommentVote) NumericReference

func (vote *UserPostCommentVote) NumericReference() uint64

NumericReference returns the numeric ID of the reference

func (*UserPostCommentVote) NumericSender

func (vote *UserPostCommentVote) NumericSender() uint64

NumericSender returns the ID of the Sender

func (*UserPostCommentVote) Reference

func (vote *UserPostCommentVote) Reference() Reference

Reference returns the reference of the vote

func (*UserPostCommentVote) Sender

func (vote *UserPostCommentVote) Sender() (user *User)

Sender returns the User that casted the vote

func (UserPostCommentVote) TableName

func (UserPostCommentVote) TableName() string

TableName returns the table name associated with the structure

func (*UserPostCommentVote) Value

func (vote *UserPostCommentVote) Value() int8

Value returns the vote's value

type UserPostCommentVoteTO

type UserPostCommentVoteTO struct {
	Hcid    uint64  `json:"hcid"`
	User    *InfoTO `json:"user"`
	Vote    int8    `json:"vote"`
	Counter uint64  `json:"counter"`
	// contains filtered or unexported fields
}

UserPostCommentVoteTO represents the TO of UserPostCommentVote

swagger:model

func (*UserPostCommentVoteTO) Original

Original returns the original object of the TO

type UserPostCommentsNotify

type UserPostCommentsNotify struct {
	From    uint64
	To      uint64
	Hpid    uint64
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter uint64    `igor:"primary_key"`
}

UserPostCommentsNotify is the model for the relation comments_notify

func (*UserPostCommentsNotify) GetTO

GetTO returns its Transfer Object

func (UserPostCommentsNotify) TableName

func (UserPostCommentsNotify) TableName() string

TableName returns the table name associated with the structure

type UserPostCommentsNotifyTO

type UserPostCommentsNotifyTO struct {
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Hpid      uint64    `json:"hpid"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

UserPostCommentsNotifyTO represents the TO of UserPostCommentsNotify

swagger:model

func (*UserPostCommentsNotifyTO) Original

Original returns the original object of the TO

type UserPostLock

type UserPostLock struct {
	User    uint64
	Hpid    uint64
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter uint64    `igor:"primary_key"`
}

UserPostLock is the model for the relation posts_no_notify

func (*UserPostLock) GetTO

func (u *UserPostLock) GetTO(users ...*User) *UserPostLockTO

GetTO returns its Transfer Object

func (*UserPostLock) NumericReference

func (lock *UserPostLock) NumericReference() uint64

NumericReference returns the numeric ID of the reference

func (*UserPostLock) NumericSender

func (lock *UserPostLock) NumericSender() uint64

NumericSender returns the ID of the Sender

func (*UserPostLock) Reference

func (lock *UserPostLock) Reference() Reference

Reference returns the reference of the lurk

func (*UserPostLock) Sender

func (lock *UserPostLock) Sender() (user *User)

Sender returns the User that casted the lock

func (UserPostLock) TableName

func (UserPostLock) TableName() string

TableName returns the table name associated with the structure

type UserPostLockTO

type UserPostLockTO struct {
	User      *InfoTO   `json:"user"`
	Hpid      uint64    `json:"hpid"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

UserPostLockTO represents the TO of UserPostLock

swagger:model

func (*UserPostLockTO) Original

func (to *UserPostLockTO) Original() *UserPostLock

Original returns the original object of the TO

type UserPostLurk

type UserPostLurk struct {
	Hpid    uint64
	From    uint64
	To      uint64
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter uint64    `igor:"primary_key"`
}

UserPostLurk is the model for the relation lurkers

func (*UserPostLurk) GetTO

func (l *UserPostLurk) GetTO(users ...*User) *UserPostLurkTO

GetTO returns its Transfer Object

func (*UserPostLurk) NumericReference

func (lurk *UserPostLurk) NumericReference() uint64

NumericReference returns the numeric ID of the reference

func (*UserPostLurk) NumericSender

func (lurk *UserPostLurk) NumericSender() uint64

NumericSender returns the ID of the Sender

func (*UserPostLurk) Reference

func (lurk *UserPostLurk) Reference() Reference

Reference returns the reference of the lurk

func (*UserPostLurk) Sender

func (lurk *UserPostLurk) Sender() (user *User)

Sender returns the User that casted the lurk

func (UserPostLurk) TableName

func (UserPostLurk) TableName() string

TableName returns the table name associated with the structure

type UserPostLurkTO

type UserPostLurkTO struct {
	Hpid      uint64    `json:"hpid"`
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

UserPostLurkTO represents the TO of UserPostLurk

swagger:model

func (*UserPostLurkTO) Original

func (to *UserPostLurkTO) Original() *UserPostLurk

Original returns the original object of the TO

type UserPostRevision

type UserPostRevision struct {
	Hpid    uint64
	Message string
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	RevNo   uint16
	Counter uint64 `igor:"primary_key"`
}

UserPostRevision is the model for the relation posts_revisions

func (*UserPostRevision) GetTO

func (p *UserPostRevision) GetTO(users ...*User) *UserPostRevisionTO

GetTO returns its Transfer Object

func (UserPostRevision) TableName

func (UserPostRevision) TableName() string

TableName returns the table name associated with the structure

type UserPostRevisionTO

type UserPostRevisionTO struct {
	Hpid      uint64    `json:"hpid"`
	Message   string    `json:"message"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	RevNo     uint16    `json:"revNo"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

UserPostRevisionTO represents the TO of UserPostRevision

swagger:model

func (*UserPostRevisionTO) Original

func (to *UserPostRevisionTO) Original() *UserPostRevision

Original returns the original object of the TO

type UserPostUserLock

type UserPostUserLock struct {
	From    uint64
	To      uint64
	Hpid    uint64
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter uint64    `igor:"primary_key"`
}

UserPostUserLock is the model for the relation comments_no_notify

func (*UserPostUserLock) GetTO

func (u *UserPostUserLock) GetTO(users ...*User) *UserPostUserLockTO

GetTO returns its Transfer Object

func (*UserPostUserLock) NumericReference

func (lock *UserPostUserLock) NumericReference() uint64

NumericReference returns the numeric ID of the reference

func (*UserPostUserLock) NumericSender

func (lock *UserPostUserLock) NumericSender() uint64

NumericSender returns the ID of the Sender

func (*UserPostUserLock) Reference

func (lock *UserPostUserLock) Reference() Reference

Reference returns the reference of the lurk

func (*UserPostUserLock) Sender

func (lock *UserPostUserLock) Sender() (user *User)

Sender returns the User that casted the lock

func (UserPostUserLock) TableName

func (UserPostUserLock) TableName() string

TableName returns the table name associated with the structure

type UserPostUserLockTO

type UserPostUserLockTO struct {
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Hpid      uint64    `json:"hpid"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

UserPostUserLockTO represents the TO of UserPostUserLock

swagger:model

func (*UserPostUserLockTO) Original

func (to *UserPostUserLockTO) Original() *UserPostUserLock

Original returns the original object of the TO

type UserPostVote

type UserPostVote struct {
	Hpid    uint64
	From    uint64
	To      uint64
	Vote    int8
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter uint64    `igor:"primary_key"`
}

UserPostVote is the model for the relation votes

func (*UserPostVote) GetTO

func (t *UserPostVote) GetTO(users ...*User) *UserPostVoteTO

GetTO returns its Transfer Object

func (*UserPostVote) NumericReference

func (vote *UserPostVote) NumericReference() uint64

NumericReference returns the numeric ID of the reference

func (*UserPostVote) NumericSender

func (vote *UserPostVote) NumericSender() uint64

NumericSender returns the ID of the Sender

func (*UserPostVote) Reference

func (vote *UserPostVote) Reference() Reference

Reference returns the reference of the vote

func (*UserPostVote) Sender

func (vote *UserPostVote) Sender() (user *User)

Sender returns the User that casted the vote

func (UserPostVote) TableName

func (UserPostVote) TableName() string

TableName returns the table name associated with the structure

func (*UserPostVote) Value

func (vote *UserPostVote) Value() int8

Value returns the vote's value

type UserPostVoteTO

type UserPostVoteTO struct {
	Hpid      uint64    `json:"hpid"`
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Vote      int8      `json:"vote"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

UserPostVoteTO represents the TO of UserPostVote

swagger:model

func (*UserPostVoteTO) Original

func (to *UserPostVoteTO) Original() *UserPostVote

Original returns the original object of the TO

type UserTO

type UserTO struct {
	Counter          uint64    `json:"counter"`
	Last             time.Time `json:"last"`
	NotifyStory      igor.JSON `json:"notifyStory"`
	Private          bool      `json:"private"`
	Lang             string    `json:"lang"`
	Username         string    `json:"username"`
	Name             string    `json:"name"`
	Surname          string    `json:"surname"`
	Gender           bool      `json:"gender"`
	BirthDate        time.Time `json:"birthDate"`
	BoardLang        string    `json:"boardLang"`
	Timezone         string    `json:"timezone"`
	Viewonline       bool      `json:"viewonline"`
	RegistrationTime time.Time `json:"registrationTime"`
	Profile          ProfileTO
	// contains filtered or unexported fields
}

UserTO represents the TO of User

swagger:model

func (*UserTO) Original

func (to *UserTO) Original() *User

Original returns the original object of the TO

type Vote

type Vote interface {
	Value() int8
	// contains filtered or unexported methods
}

Vote is a generic interface to represent a vote

type Whitelist

type Whitelist struct {
	From    uint64
	To      uint64
	Time    time.Time `sql:"default:(now() at time zone 'utc')"`
	Counter uint64    `igor:"primary_key"`
}

Whitelist is the model for the relation whitelist

func (*Whitelist) GetTO

func (w *Whitelist) GetTO(users ...*User) *WhitelistTO

GetTO returns its Transfer Object

func (Whitelist) TableName

func (Whitelist) TableName() string

TableName returns the table name associated with the structure

type WhitelistTO

type WhitelistTO struct {
	FromInfo  *InfoTO   `json:"from"`
	ToInfo    *InfoTO   `json:"to"`
	Time      time.Time `json:"time"`
	Timestamp int64     `json:"timestamp"`
	Counter   uint64    `json:"counter"`
	// contains filtered or unexported fields
}

WhitelistTO represents the TO of Whitelist

swagger:model

func (*WhitelistTO) Original

func (to *WhitelistTO) Original() *Whitelist

Original returns the original object of the TO

Jump to

Keyboard shortcuts

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