services

package module
v0.0.0-...-4de854c Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 8 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountIdsToStrings

func AccountIdsToStrings(accountIds []AccountId) []string

func AddToSocialList

func AddToSocialList(appCtx AppCtx, owner AccountId, listType SocialListType, idToAdd AccountId) error

func HashPassword

func HashPassword(password string) (string, error)

func RemoveFromSocialList

func RemoveFromSocialList(appCtx AppCtx, owner AccountId, listType string, idToRemove AccountId) error

func UpdateUserContact

func UpdateUserContact(appCtx AppCtx, accountId AccountId, ip net.IP, port int32) error

Types

type AccountId

type AccountId string

func CreateAccount

func CreateAccount(app AppCtx, username string, password string) (AccountId, error)

func GetSocialList

func GetSocialList(appCtx AppCtx, owner AccountId, listType SocialListType) ([]AccountId, error)

func Login

func Login(appCtx AppCtx, username string, password string, ip net.IP, port int32) (AccountId, error)

func NewAccountId

func NewAccountId(id string) AccountId

func NilAccountId

func NilAccountId() AccountId

func StringsToAccountIds

func StringsToAccountIds(accountIds []string) []AccountId

func (AccountId) String

func (a AccountId) String() string

type AppCtx

type AppCtx struct {
	Server *grpc.Server
	// contains filtered or unexported fields
}

func NewAppCtx

func NewAppCtx(l zerolog.Logger, s *grpc.Server, db *sql.DB) AppCtx

func (AppCtx) Log

func (a AppCtx) Log(f string) zerolog.Logger

type SocialListType

type SocialListType string
const (
	SocialListType_BLOCKED   SocialListType = "BLOCKED"
	SocialListType_FOLLOWS   SocialListType = "FOLLOWS"
	SocialListType_FOLLOWING SocialListType = "FOLLOWING"
)

type UserContact

type UserContact struct {
	AccountID AccountId
	Ip        net.IP
	Port      int32
	Time      time.Time
}

func GetUserContacts

func GetUserContacts(appCtx AppCtx, accountIDs []AccountId) ([]UserContact, error)

Jump to

Keyboard shortcuts

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