models

package
v0.0.0-...-bd6b2d5 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreFriends

func AreFriends(ownId, ownerId uint) bool

func GetDB

func GetDB() *gorm.DB

func Login

func Login(login, password string) map[string]interface{}

func Logout

func Logout(token string) map[string]interface{}

Types

type Friend

type Friend struct {
	gorm.Model
	OwnerId uint `json:"owner_id"`
	OwnId   uint `json:"own_id"`
}

func (*Friend) Add

func (friend *Friend) Add() map[string]interface{}

func (*Friend) Remove

func (friend *Friend) Remove() map[string]interface{}

func (*Friend) Validate

func (friend *Friend) Validate() (map[string]interface{}, bool)

type Message

type Message struct {
	gorm.Model
	Body       string `json:"body"`
	SenderId   uint   `json:"sender_id"`
	ReceiverId uint   `json:"receiver_id"`
}

func GetLastMessage

func GetLastMessage(senderId, receiverId uint) *Message

func GetMessages

func GetMessages(senderId, receiverId uint) []*Message

func (*Message) Create

func (message *Message) Create() map[string]interface{}

func (*Message) Validate

func (message *Message) Validate() (map[string]interface{}, bool)

type Token

type Token struct {
	UserId         uint
	ExpirationTime int64
	jwt.StandardClaims
}

type User

type User struct {
	gorm.Model
	Login    string `json:"login"`
	Password string `json:"password"`
	Token    string `sql:"-";json:"token"`
}

func GetFriends

func GetFriends(userId uint) []*User

func (*User) Create

func (user *User) Create() map[string]interface{}

func (*User) Validate

func (user *User) Validate() (map[string]interface{}, bool)

Jump to

Keyboard shortcuts

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