uplink

package
v0.0.0-...-1106aab Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2016 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Listener struct {
		Proto    string
		ConnInfo string
	}

	DB struct {
		ConnString string
	}

	FCM struct {
		SenderID uint64
		APIKey   string
	}
}

Config represents the configuration that should be provided to uplink.Start to fully initialize a Server instance.

func ReadConfig

func ReadConfig(path string) (cfg *Config, err error)

ReadConfig reads the configuration for uplink from a file specified by path. See provided example for syntax.

type Conversation

type Conversation struct {
	ID           int64  `igor:"primary_key"`
	Name         string `sql:"default:''"`
	Creator      int64
	CreationTime time.Time `sql:"default:(now() at time zone 'utc')"`
}

Conversation represents a conversation between many Users.

func (Conversation) TableName

func (Conversation) TableName() string

TableName returns the name of the table associated with Conversation.

type FCMSubscription

type FCMSubscription struct {
	ID    int64 `igor:"primary_key"`
	UID   int64
	RegID string
}

FCMSubscription represents the RegId of a mobile user associated with FCM.

func (FCMSubscription) TableName

func (FCMSubscription) TableName() string

TableName returns the name of the table associated with Session.

type Friendship

type Friendship struct {
	ID          int64 `igor:"primary_key"`
	Sender      int64
	Receiver    int64
	Established bool
}

Friendship represents a relationship between two users that contacted each other, and appear in each friendlist.

func (Friendship) TableName

func (Friendship) TableName() string

TableName returns the name of the table associated with Friendship.

type Invite

type Invite struct {
	ID           int64 `igor:"primary_key"`
	Conversation int64
	Sender       int64
	Receiver     int64
	RecvTime     time.Time `sql:"default:(now() at time zone 'utc')"`
}

Invite represents an invite to a given Conversation.

func (Invite) TableName

func (Invite) TableName() string

TableName returns the name of the table associated with Invite.

type Member

type Member struct {
	ID           int64 `igor:"primary_key"`
	UID          int64
	Conversation int64
	JoinTime     time.Time `sql:"default:(now() at time zone 'utc')"`
}

Member represents the membership of a given User to a Conversation.

func (Member) TableName

func (Member) TableName() string

TableName returns the name of the table associated with Member.

type Message

type Message struct {
	ID           int64 `igor:"primary_key"`
	Tag          int64
	Conversation int64
	Sender       int64
	RecvTime     time.Time `sql:"default:(now() at time zone 'utc')"`
	Body         string
}

Message represents a message belonging to a Conversation.

func (Message) TableName

func (Message) TableName() string

TableName returns the name of the table associated with Message.

type Session

type Session struct {
	ID        int64  `igor:"primary_key"`
	SessionID string `sql:"default:encode(digest(gen_random_bytes(256),'sha256'),'hex')"`
	UID       int64
}

Session represents a session.

func (Session) TableName

func (Session) TableName() string

TableName returns the name of the table associated with Session.

type Uplink struct {
	*log.Logger
	// contains filtered or unexported fields
}

Uplink instance structure.

func New

func New(cfg *Config, logger *log.Logger) (*Uplink, error)

New Initializes and returns an instance of Uplink according to the given Config.

func (*Uplink) Start

func (u *Uplink) Start() (err error)

Start starts a previously configured Uplink instance.

type User

type User struct {
	ID       int64 `igor:"primary_key"`
	Authpass string
	Name     string
	RegTime  time.Time `sql:"default:(now() at time zone 'utc')"`
}

User represents an user of the service.

func (User) TableName

func (User) TableName() string

TableName returns the name of the table associated with User.

Jump to

Keyboard shortcuts

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