crud

package
v0.0.0-...-7361216 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2019 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDocument

func CreateDocument(email, title string) (file *drive.File, err error)

CreateDocument creates a new document, with given title and gives writer role to email.

func CreateTemplate

func CreateTemplate(email, template, title string) (file *drive.File, err error)

CreateTemplate creates a new document with contents of template document and gives writer role to email

func LastModifiedDate

func LastModifiedDate(fileID string) (string, error)

LastModifiedDate returns last modified date of drive file

func SetPermission

func SetPermission(fileID, email, perm string) (err error)

SetPermission sets read or write permission to a user for a document

Types

type Document

type Document struct {
	DocID       string `json:"doc_id" gorm:"type: TEXT; UNIQUE; PRIMARY_KEY; NOT NULL"`
	DocTitle    string `json:"doc_title" gorm:"type: TEXT; NOT NULL"`
	DocURL      string `json:"doc_url" gorm:"type: TEXT; NOT NULL"`
	Owner1      string `json:"owner1" gorm:"type: TEXT"`
	Owner2      string `json:"owner2" gorm:"type: TEXT"`
	Signed1     int    `json:"signed1" gorm:"type: INTEGER"`
	Signed2     int    `json:"signed2" gorm:"type: INTEGER"`
	DateSigned1 string `json:"date_signed1" gorm:"type: TEXT"`
	DateSigned2 string `json:"date_signed2" gorm:"type: TEXT"`
}

Document struct represents a document of google drive, with it's owners and permissions

func AddDocOwner

func AddDocOwner(email, fileID string) (*Document, error)

AddDocOwner adds the user 'email' as the owner of doc 'fileID' to DB

func AddUserDoc

func AddUserDoc(id, title, url, email string) (*Document, error)

AddUserDoc adds a document in a DB

func AddUserSign

func AddUserSign(email, fileID string) (*Document, error)

AddUserSign sets the sign field of a second user document in DB to either true or false

func GetUserDoc

func GetUserDoc(fileID string) (ud *Document, err error)

GetUserDoc returns a UserDoc structure with a document info from DB

func GetUserDocList

func GetUserDocList(email string) ([]Document, error)

GetUserDocList returns a slice of documents that belong to user

func RemoveUserSign

func RemoveUserSign(email, fileID string) (*Document, error)

RemoveUserSign removes signed and signed date fields of a document from DB

Jump to

Keyboard shortcuts

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