common

package
v0.0.0-...-83a686f Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Rot1       = "Rot1"
	Rot13      = "Rot13"
	Base64     = "Base64"
	Md5        = "Md5"
	AllCiphers = []string{Rot1, Rot13, Base64, Md5}
)
View Source
var MessagesIndexName = "messages_and_their_ciphers"

Functions

This section is empty.

Types

type EsMessageRepo

type EsMessageRepo struct {
	Client *elasticsearch.Client
}

func (*EsMessageRepo) Create

func (r *EsMessageRepo) Create(ctx context.Context, message NewMessage) (*Message, error)

func (*EsMessageRepo) Get

func (r *EsMessageRepo) Get(ctx context.Context, id string) (*Message, error)

func (*EsMessageRepo) List

func (r *EsMessageRepo) List(ctx context.Context) ([]Message, error)

func (*EsMessageRepo) SetBase64

func (r *EsMessageRepo) SetBase64(ctx context.Context, id string, data string) error

func (*EsMessageRepo) SetMd5

func (r *EsMessageRepo) SetMd5(ctx context.Context, id string, data string) error

func (*EsMessageRepo) SetRot1

func (r *EsMessageRepo) SetRot1(ctx context.Context, id string, data string) error

func (*EsMessageRepo) SetRot13

func (r *EsMessageRepo) SetRot13(ctx context.Context, id string, data string) error

type Message

type Message struct {
	ID    string `json:"id"`
	Plain string `json:"plain"`

	Rot1  *string `json:"rot_1,omitempty"`
	Rot13 *string `json:"rot_13,omitempty"`

	Base64 *string `json:"base_64,omitempty"`
	Md5    *string `json:"md_5,omitempty"`

	CreatedAt  time.Time `json:"created_at"`
	ModifiedAt time.Time `json:"modified_at"`
}

type MessageArgs

type MessageArgs struct {
	MessageId string `json:"message_id"`
}

func FromInterface

func FromInterface(i interface{}) (*MessageArgs, error)

func (*MessageArgs) ToMap

func (j *MessageArgs) ToMap() map[string]interface{}

type MessageCreate

type MessageCreate interface {
	Create(ctx context.Context, message NewMessage) (*Message, error)
}

type MessageReads

type MessageReads interface {
	Get(ctx context.Context, id string) (*Message, error)
	List(ctx context.Context) ([]Message, error)
}

type MessageUpdate

type MessageUpdate interface {
	SetRot1(ctx context.Context, id string, data string) error
	SetRot13(ctx context.Context, id string, data string) error
	SetBase64(ctx context.Context, id string, data string) error
	SetMd5(ctx context.Context, id string, data string) error
}

type NewMessage

type NewMessage struct {
	Plain string `json:"plain"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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