repositories

package
v0.0.0-...-159e443 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRepository

type AuthRepository struct {
	// contains filtered or unexported fields
}

AuthRepository ..

func NewAuthRepo

func NewAuthRepo(db *gorm.DB) *AuthRepository

NewAuthRepo ..

func (*AuthRepository) CheckAccessToken

func (r *AuthRepository) CheckAccessToken(token string) (accessToken models.Accesstoken, err error)

CheckAccessToken checks Access Token

func (*AuthRepository) CreateAccessToken

func (r *AuthRepository) CreateAccessToken(accessToken string, user models.User) models.Accesstoken

CreateAccessToken repository returns auth access Token

func (*AuthRepository) CreateUser

func (r *AuthRepository) CreateUser(username string, password string, fullname string) models.User

CreateUser repository creates user

func (*AuthRepository) GetUser

func (r *AuthRepository) GetUser(username string, password string) (user models.User, err error)

GetUser returns specific user

type IAuthRepository

type IAuthRepository interface {
	CreateAccessToken(accessToken string, user models.User) models.Accesstoken
	GetUser(username string, password string) (user models.User, err error)
	CreateUser(username string, password string, fullname string) models.User
	CheckAccessToken(token string) (accessToken models.Accesstoken, err error)
}

IAuthRepository is a interface of AuthRepository

type IMessageRepository

type IMessageRepository interface {
	CreateMessage(
		fromUser models.User, toUser models.User, messageContext models.MessageCreate,
	) (message models.Message)

	FetchUsersMessages(
		fromUser models.User, toUser models.User,
	) Messages
}

IMessageRepository is a interface of MessageRepository

type IUserRepository

type IUserRepository interface {
	FetchUsers() Users
	FetchUserByID(userID uint) (user models.User, err error)
	FetchUserByUsername(username string) (user models.User, err error)
}

IUserRepository is a interface of UserRepository

type MessageRepository

type MessageRepository struct {
	// contains filtered or unexported fields
}

MessageRepository ..

func NewMessageRepo

func NewMessageRepo(db *gorm.DB) *MessageRepository

NewMessageRepo ..

func (*MessageRepository) CreateMessage

func (r *MessageRepository) CreateMessage(
	fromUser models.User, toUser models.User,
	messageContext models.MessageCreate,
) (message models.Message)

CreateMessage inserts message to the database

func (*MessageRepository) FetchUsersMessages

func (r *MessageRepository) FetchUsersMessages(
	fromUser models.User, toUser models.User,
) Messages

FetchUsersMessages returns messages

type Messages

type Messages []models.MessageResponse

Messages represents list of messages

type MockAuthRepository

type MockAuthRepository struct {
	mock.Mock
}

MockAuthRepository is a mock implementation for unit tests

func (*MockAuthRepository) CheckAccessToken

func (m *MockAuthRepository) CheckAccessToken(token string) (accessToken models.Accesstoken, err error)

CheckAccessToken is a mocked func

func (*MockAuthRepository) CreateAccessToken

func (m *MockAuthRepository) CreateAccessToken(accessToken string, user models.User) models.Accesstoken

CreateAccessToken is a mocked func

func (*MockAuthRepository) CreateUser

func (m *MockAuthRepository) CreateUser(username string, password string, fullname string) models.User

CreateUser is a mocked func

func (*MockAuthRepository) GetUser

func (m *MockAuthRepository) GetUser(username string, password string) (user models.User, err error)

GetUser is a mocked func

type MockMessageRepository

type MockMessageRepository struct {
	mock.Mock
}

MockMessageRepository is a mock implementation for unit tests

func (*MockMessageRepository) CreateMessage

func (m *MockMessageRepository) CreateMessage(
	fromUser models.User, toUser models.User,
	messageContext models.MessageCreate,
) (message models.Message)

CreateMessage is a mocked func

func (*MockMessageRepository) FetchUsersMessages

func (m *MockMessageRepository) FetchUsersMessages(
	fromUser models.User, toUser models.User,
) Messages

FetchUsersMessages is a mocked func

type MockUserRepository

type MockUserRepository struct {
	mock.Mock
}

MockUserRepository is a mock implementation for unit tests

func (*MockUserRepository) FetchUserByID

func (m *MockUserRepository) FetchUserByID(userID uint) (user models.User, err error)

FetchUserByID is a mocked func

func (*MockUserRepository) FetchUserByUsername

func (m *MockUserRepository) FetchUserByUsername(username string) (user models.User, err error)

FetchUserByUsername is a mocked func

func (*MockUserRepository) FetchUsers

func (m *MockUserRepository) FetchUsers() Users

FetchUsers is a mocked func

type UserRepository

type UserRepository struct {
	// contains filtered or unexported fields
}

UserRepository ..

func NewUserRepo

func NewUserRepo(db *gorm.DB) *UserRepository

NewUserRepo returns new UserRepository

func (*UserRepository) FetchUserByID

func (r *UserRepository) FetchUserByID(userID uint) (user models.User, err error)

FetchUserByID repository returns user

func (*UserRepository) FetchUserByUsername

func (r *UserRepository) FetchUserByUsername(username string) (user models.User, err error)

FetchUserByUsername repository returns user

func (*UserRepository) FetchUsers

func (r *UserRepository) FetchUsers() Users

FetchUsers Repository returns user list

type Users

type Users []models.User

Users is list of users

Jump to

Keyboard shortcuts

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