models

package
v0.0.0-...-4257d44 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Languages = []*Language{
	&Language{"c", "c_cpp", "c", "C"},
	&Language{"css", "css", "css", "CSS"},
	&Language{"go", "golang", "go", "Go"},
	&Language{"html", "html", "html", "HTML"},
	&Language{"javascript", "javascript", "javascript", "Javascript"},
	&Language{"javascript", "json", "javascript", "JSON"},
}

Languages contain array of languages

Functions

func GetAceCode

func GetAceCode(language string) string

func GetCode

func GetCode(language string) string

func GetSlackFileType

func GetSlackFileType(language string) string

func NewMailer

func NewMailer(email *Email)

func SetLocation

func SetLocation(loc *time.Location)

Types

type Email

type Email struct {
	Server      string
	Port        string
	Address     string
	Password    string
	SenderName  string
	SenderEmail string
	Enabled     bool
}

func NewEmailSettings

func NewEmailSettings(server, port, address, password, sendername, senderemail string) *Email

NewEmailSettings creates new email

type Language

type Language struct {
	Code          string
	AceCode       string
	SlackFileType string
	Name          string
}

Language contains structure for language

type Mailer

type Mailer struct {
	Sender     mail.Address
	Receiver   mail.Address
	Server     string
	PortNumber int
	Auth       smtp.Auth
	Data       *SnippetInfo
}
var SmtpMailer Mailer

func (*Mailer) MailBody

func (m *Mailer) MailBody() []byte

func (*Mailer) MakeHeader

func (m *Mailer) MakeHeader() string

func (*Mailer) SendMail

func (m *Mailer) SendMail() error

func (*Mailer) ServerName

func (m *Mailer) ServerName() string

type Model

type Model interface {
	BucketName() string
	ID() string
	Value() interface{}
}

type ShareInfo

type ShareInfo struct {
	Method   string
	SharedTo string
}

type Slack

type Slack struct {
	Token string
}

type SnippetInfo

type SnippetInfo struct {
	Owner           string
	Key             string
	Time            string
	Title           string
	Language        string
	Code            string
	References      string
	SharedBySomeone bool
	SharedBy        string
	SharedToSomeone bool
	SharedTo        []*ShareInfo
	CreatedAt       int64
	ModifiedAt      int64
	DeletedAt       int64
}

SnippetInfo contains information about snippets stored

func NewSnippet

func NewSnippet(owner, title, language, code, references string, sharedBySomeone bool, sharedBy string, sharedToSomeone bool, sharedTo []*ShareInfo) *SnippetInfo

NewSnippet creates new snippet

func (*SnippetInfo) BucketName

func (s *SnippetInfo) BucketName() string

func (*SnippetInfo) ID

func (s *SnippetInfo) ID() string

func (*SnippetInfo) Value

func (s *SnippetInfo) Value() interface{}

type Snippets

type Snippets []*SnippetInfo

Snippets is the type for array of snippets

func (Snippets) Others

func (s Snippets) Others() Snippets

func (Snippets) Own

func (s Snippets) Own() Snippets

func (Snippets) Reverse

func (s Snippets) Reverse() Snippets

func (Snippets) SharedTo

func (s Snippets) SharedTo() Snippets

type User

type User struct {
	Name     string
	Password string
	Endpoint string
	Slack    *Slack
	Email    *Email
}

User contains information about snippets stored

func NewUser

func NewUser(name, password string) *User

NewUser creates new user

func (*User) BucketName

func (u *User) BucketName() string

func (*User) ID

func (u *User) ID() string

func (*User) Value

func (u *User) Value() interface{}

Jump to

Keyboard shortcuts

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