tinylib

package module
v0.0.0-...-46b9f99 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2019 License: GPL-3.0 Imports: 20 Imported by: 0

README

tinylib

GoDoc codecov

Documentation

Overview

Package tinylib provides small functions for aws api gateway with lambda

Package tinylib provides small functions for aws api gateway with lambda

Package tinylib provides small functions for aws api gateway with lambda

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorUserExists    = errors.New("Specified User ID already exists.")
	ErrorUserNotExists = errors.New("Specified User ID does not existed.")
)

Functions

func CreateLocalRootUser

func CreateLocalRootUser(userid string, password string) error

func DecryptByAES

func DecryptByAES(cipherText []byte) ([]byte, error)

func DecryptByAESwithBase64

func DecryptByAESwithBase64(cipherText string) (string, error)

func EncryptByAES

func EncryptByAES(plainText string) ([]byte, error)

func EncryptByAESwithBase64

func EncryptByAESwithBase64(plainText string) (string, error)

func GetIndexWithAdd

func GetIndexWithAdd(indexname string) (int64, error)

func GetIndexWithAddWithTTL

func GetIndexWithAddWithTTL(indexname string, timeoutSecond int64) (int64, error)

func SendEmail

func SendEmail(from string, to []string, title string, body string) error

func SendSQSMessage

func SendSQSMessage(message map[string]string, queue_name string, delaySeconds int64) error

Types

type Config

type Config struct {
	AWS_REGION            string
	SESSION_SALT          string
	SESSION_SALT_DB       string
	PASSWORD_SALT         string
	PASSWORD_SALT_DB      string
	DynamoDB_TABLE_NAME   string
	DynamoDB_TABLE_PREFIX string
	DynamoDB_TABLE_SUFFIX string
	DynamoDb              *dynamo.DB
	DynamoTable           dynamo.Table
	Sqs                   *sqs.SQS
	SqsBaseURL            string
}

func (*Config) DynamoTableDelete

func (self *Config) DynamoTableDelete(prime string) *dynamo.Delete

func (*Config) DynamoTableGet

func (self *Config) DynamoTableGet(prime string) *dynamo.Query

func (*Config) DynamoTablePut

func (self *Config) DynamoTablePut(item interface{}) *dynamo.Put

func (*Config) DynamoTableUpdate

func (self *Config) DynamoTableUpdate(prime string) *dynamo.Update

func (*Config) DynamoTableWriteTx

func (self *Config) DynamoTableWriteTx() *dynamo.WriteTx

func (*Config) GenerateDynamoDBPrime

func (self *Config) GenerateDynamoDBPrime(prime string) string

func (*Config) GetAESkey

func (self *Config) GetAESkey() string

func (*Config) GetAWSregion

func (self *Config) GetAWSregion() string

func (*Config) GetDynamoDBtable

func (self *Config) GetDynamoDBtable() dynamo.Table

func (*Config) GetDynamoDBtableName

func (self *Config) GetDynamoDBtableName() string

func (*Config) GetPasswordSalt

func (self *Config) GetPasswordSalt() string

func (*Config) GetS3

func (self *Config) GetS3() *s3.S3

func (*Config) GetSQS

func (self *Config) GetSQS() *sqs.SQS

func (*Config) GetSQSBaseURL

func (self *Config) GetSQSBaseURL() string

func (*Config) GetSessionSalt

func (self *Config) GetSessionSalt() string

type ConfigInterface

type ConfigInterface interface {
	GetAWSregion() string
	GetDynamoDBtableName() string
	//GetDynamoDBprefix() string
	GenerateDynamoDBPrime(prime string) string
	DynamoTableGet(prime string) *dynamo.Query
	DynamoTablePut(item interface{}) *dynamo.Put
	DynamoTableWriteTx() *dynamo.WriteTx
	DynamoTableDelete(prime string) *dynamo.Delete
	DynamoTableUpdate(prime string) *dynamo.Update
	GetSessionSalt() string
	GetPasswordSalt() string
	GetAESkey() string
	GetDynamoDBtable() dynamo.Table
	GetS3() *s3.S3
	GetSQS() *sqs.SQS
	GetSQSBaseURL() string
}

func GetConfig

func GetConfig() (ConfigInterface, error)

type Index

type Index struct {
	Prime string `dynamo:"prime"`
	Sort  string `dynamo:"sort"`
	Num   int64
	TTL   int64
}

type UserInterface

type UserInterface interface {
	Save() error
	IsAnonymous() bool
	IsAdmin() bool
	GetSort() string
	SetNickname(string) error
	PasswordCheck(string) error
	GetJsonVal(string) (string, error)
	SetJsonVal(key string, val string) error
	SetBasicAttr(disabled bool, admin bool, staff bool) error
}

func CreateLocalUser

func CreateLocalUser(userid string, password string, nickname string) (UserInterface, error)

func GetAllUser

func GetAllUser(pageKey string) ([]UserInterface, string, error)

func GetAnonymousUser

func GetAnonymousUser() UserInterface

func GetOrNewUser

func GetOrNewUser(email string, provider string) (UserInterface, error)

func GetUser

func GetUser(sort string) (UserInterface, error)

func LoginLocalUser

func LoginLocalUser(userid string, password string) (UserInterface, error)

Jump to

Keyboard shortcuts

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