Documentation
¶
Overview ¶
Package data supports interacting with the main database and defines a few important data types.
Index ¶
- Constants
- func BlobsTable(siteID int64) string
- func Init() error
- type Blob
- func (*Blob) Descriptor() ([]byte, []int)
- func (m *Blob) GetId() int64
- func (m *Blob) GetK() int64
- func (m *Blob) GetRole() string
- func (m *Blob) GetUpdated() *time.Time
- func (m *Blob) GetV() []byte
- func (*Blob) ProtoMessage()
- func (m *Blob) Reset()
- func (m *Blob) String() string
- func (m *Blob) XXX_DiscardUnknown()
- func (m *Blob) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Blob) XXX_Merge(src proto.Message)
- func (m *Blob) XXX_Size() int
- func (m *Blob) XXX_Unmarshal(b []byte) error
- type BlobDeleter
- type BlobGetter
- type BlobInserter
- type BlobManager
- type Content
- func (*Content) Descriptor() ([]byte, []int)
- func (m *Content) GetAuthor() int64
- func (m *Content) GetBody() []byte
- func (m *Content) GetId() int64
- func (m *Content) GetMetaDesc() string
- func (m *Content) GetMetaTitle() string
- func (m *Content) GetParent() int64
- func (m *Content) GetSite() int64
- func (m *Content) GetSlug() string
- func (m *Content) GetStatus() string
- func (m *Content) GetTitle() string
- func (m *Content) GetType() string
- func (m *Content) GetUpdated() *time.Time
- func (*Content) ProtoMessage()
- func (m *Content) Reset()
- func (m *Content) String() string
- func (m *Content) XXX_DiscardUnknown()
- func (m *Content) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Content) XXX_Merge(src proto.Message)
- func (m *Content) XXX_Size() int
- func (m *Content) XXX_Unmarshal(b []byte) error
- type ContentDeleter
- type ContentGetter
- type ContentInserter
- type ContentManager
- type DB
- type Media
- func (*Media) Descriptor() ([]byte, []int)
- func (m *Media) GetAlt() string
- func (m *Media) GetDesc() string
- func (m *Media) GetExt() string
- func (m *Media) GetId() string
- func (m *Media) GetName() string
- func (m *Media) GetSite() int64
- func (m *Media) GetUploaded() *time.Time
- func (*Media) ProtoMessage()
- func (m *Media) Reset()
- func (m *Media) String() string
- func (m *Media) XXX_DiscardUnknown()
- func (m *Media) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Media) XXX_Merge(src proto.Message)
- func (m *Media) XXX_Size() int
- func (m *Media) XXX_Unmarshal(b []byte) error
- type Ops
- type Option
- func (*Option) Descriptor() ([]byte, []int)
- func (m *Option) GetK() string
- func (m *Option) GetSite() int64
- func (m *Option) GetV() []byte
- func (*Option) ProtoMessage()
- func (m *Option) Reset()
- func (m *Option) String() string
- func (m *Option) XXX_DiscardUnknown()
- func (m *Option) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Option) XXX_Merge(src proto.Message)
- func (m *Option) XXX_Size() int
- func (m *Option) XXX_Unmarshal(b []byte) error
- type OptionDeleter
- type OptionGetter
- type OptionInserter
- type OptionManager
- type Site
- func (*Site) Descriptor() ([]byte, []int)
- func (m *Site) GetDomain() string
- func (m *Site) GetFavicon() string
- func (m *Site) GetId() int64
- func (m *Site) GetLanguage() string
- func (m *Site) GetLogo() string
- func (m *Site) GetName() string
- func (m *Site) GetTls() uint32
- func (m *Site) GetUpdated() *time.Time
- func (*Site) ProtoMessage()
- func (m *Site) Reset()
- func (m *Site) String() string
- func (m *Site) XXX_DiscardUnknown()
- func (m *Site) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Site) XXX_Merge(src proto.Message)
- func (m *Site) XXX_Size() int
- func (m *Site) XXX_Unmarshal(b []byte) error
- type SiteDeleter
- type SiteGetter
- type SiteInserter
- type SiteManager
- type SiteMessage
- func (*SiteMessage) Descriptor() ([]byte, []int)
- func (m *SiteMessage) GetCreated() *time.Time
- func (m *SiteMessage) GetId() int64
- func (m *SiteMessage) GetK() string
- func (m *SiteMessage) GetMessage() string
- func (m *SiteMessage) GetRole() string
- func (m *SiteMessage) GetSiteId() int64
- func (*SiteMessage) ProtoMessage()
- func (m *SiteMessage) Reset()
- func (m *SiteMessage) String() string
- func (m *SiteMessage) XXX_DiscardUnknown()
- func (m *SiteMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SiteMessage) XXX_Merge(src proto.Message)
- func (m *SiteMessage) XXX_Size() int
- func (m *SiteMessage) XXX_Unmarshal(b []byte) error
- type Transaction
- type User
- func (*User) Descriptor() ([]byte, []int)
- func (m *User) GetEmail() string
- func (m *User) GetFname() string
- func (m *User) GetId() int64
- func (m *User) GetLname() string
- func (m *User) GetPass() []byte
- func (m *User) GetRole() string
- func (m *User) GetUname() string
- func (m *User) GetUpdated() *time.Time
- func (*User) ProtoMessage()
- func (m *User) Reset()
- func (m *User) String() string
- func (m *User) XXX_DiscardUnknown()
- func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *User) XXX_Merge(src proto.Message)
- func (m *User) XXX_Size() int
- func (m *User) XXX_Unmarshal(b []byte) error
- type UserDeleter
- type UserGetter
- type UserInserter
- type UserManager
- type UserMessage
- func (*UserMessage) Descriptor() ([]byte, []int)
- func (m *UserMessage) GetCreated() *time.Time
- func (m *UserMessage) GetId() int64
- func (m *UserMessage) GetK() string
- func (m *UserMessage) GetMessage() string
- func (m *UserMessage) GetUserId() int64
- func (*UserMessage) ProtoMessage()
- func (m *UserMessage) Reset()
- func (m *UserMessage) String() string
- func (m *UserMessage) XXX_DiscardUnknown()
- func (m *UserMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *UserMessage) XXX_Merge(src proto.Message)
- func (m *UserMessage) XXX_Size() int
- func (m *UserMessage) XXX_Unmarshal(b []byte) error
- type UserMeta
- func (*UserMeta) Descriptor() ([]byte, []int)
- func (m *UserMeta) GetK() string
- func (m *UserMeta) GetUpdated() *time.Time
- func (m *UserMeta) GetUserId() int64
- func (m *UserMeta) GetV() []byte
- func (*UserMeta) ProtoMessage()
- func (m *UserMeta) Reset()
- func (m *UserMeta) String() string
- func (m *UserMeta) XXX_DiscardUnknown()
- func (m *UserMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *UserMeta) XXX_Merge(src proto.Message)
- func (m *UserMeta) XXX_Size() int
- func (m *UserMeta) XXX_Unmarshal(b []byte) error
- type UserMetaDeleter
- type UserMetaGetter
- type UserMetaInserter
- type UserMetaManager
- type UserPasswordGetter
Constants ¶
const ( SitesTable = "sites" ContentTable = "content" UsersTable = "users" UserMetaTable = "user_meta" OptionsTable = "options" MediaTable = "media" SiteMessagesTable = "site_messages" UserMessagesTable = "user_messages" )
Variables ¶
This section is empty.
Functions ¶
func BlobsTable ¶
BlobsTable gives the name of the blobs table for the site with the given ID. If siteID is zero, then the name of the system's blobs table is returned.
Types ¶
type Blob ¶
type Blob struct { // Row ID in the table. Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // General field to specify what kind of blob this is. Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` // Key to connect the Blob with content (not an actual foreign key). K int64 `protobuf:"varint,3,opt,name=k,proto3" json:"k,omitempty"` // The data. V []byte `protobuf:"bytes,4,opt,name=v,proto3" json:"v,omitempty"` // Time of the last update. Updated *time.Time `protobuf:"bytes,5,opt,name=updated,proto3" json:"updated,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A Blob is a general-use container for binary data.
func (*Blob) Descriptor ¶
func (*Blob) GetUpdated ¶
func (*Blob) ProtoMessage ¶
func (*Blob) ProtoMessage()
func (*Blob) XXX_DiscardUnknown ¶
func (m *Blob) XXX_DiscardUnknown()
func (*Blob) XXX_Unmarshal ¶
type BlobDeleter ¶
type BlobDeleter interface { }
type BlobGetter ¶
type BlobGetter interface { // BlobsByRoleInK selects blobs where the role matches a role in the given list and the K equals the given k. // If not matching Blobs are found, an empty slice is returned but no error. BlobsByRoleInK(site int64, roles []string, k int64) ([]Blob, error) // BlobByRoleLikeLast returns the last Blob that is matched to the role column using the LIKE feature, ordered // by the record ID. BlobByRoleLikeLast(site int64, kPattern string) (*Blob, error) }
type BlobInserter ¶
type BlobInserter interface { }
type BlobManager ¶
type BlobManager interface { BlobGetter BlobInserter BlobDeleter }
type Content ¶
type Content struct { // Row ID in the table. Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // Site ID that the content is part of. Site int64 `protobuf:"varint,2,opt,name=site,proto3" json:"site,omitempty"` // Valid URL path part with no slashes. Slug string `protobuf:"bytes,3,opt,name=slug,proto3" json:"slug,omitempty"` // The ID of the author. Author int64 `protobuf:"varint,4,opt,name=author,proto3" json:"author,omitempty"` // The general type of the content, such as "page" or "post". Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"` // Either 0 or the ID of the parent in the same table. Parent int64 `protobuf:"varint,6,opt,name=parent,proto3" json:"parent,omitempty"` // Title for displaying. Title string `protobuf:"bytes,7,opt,name=title,proto3" json:"title,omitempty"` // Title to give in an HTML meta tag; optional but not null. MetaTitle string `protobuf:"bytes,8,opt,name=meta_title,json=metaTitle,proto3" json:"meta_title,omitempty"` // Description to give in an HTML meta tag; optional but not null. MetaDesc string `protobuf:"bytes,9,opt,name=meta_desc,json=metaDesc,proto3" json:"meta_desc,omitempty"` // Either blank or the published (and compiled) body, cached for quick loading. Body []byte `protobuf:"bytes,10,opt,name=body,proto3" json:"body,omitempty"` // Publication status is one of 'draft', 'published', 'unsaved', or 'trashed'; // defaults to 'draft' in the database. Status string `protobuf:"bytes,11,opt,name=status,proto3" json:"status,omitempty"` // Time of the last update. Updated *time.Time `protobuf:"bytes,12,opt,name=updated,proto3" json:"updated,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A Content is piece of the content of an email body. Each email must have at least one Content.
func (*Content) Descriptor ¶
func (*Content) GetMetaDesc ¶
func (*Content) GetMetaTitle ¶
func (*Content) GetUpdated ¶
func (*Content) ProtoMessage ¶
func (*Content) ProtoMessage()
func (*Content) XXX_DiscardUnknown ¶
func (m *Content) XXX_DiscardUnknown()
func (*Content) XXX_Marshal ¶
func (*Content) XXX_Unmarshal ¶
type ContentDeleter ¶
type ContentGetter ¶
type ContentGetter interface { // ContentByID returns a single Content by its ID. ContentByID(id int64) (*Content, error) // ContentsByIDs returns the Content rows selected by their ID. ContentsByIDs(IDs []int64) ([]Content, error) ContentsIDIn(ids []int64) ([]Content, error) ContentBySiteSlug(siteID int64, slug string) (*Content, string, error) ContentByAuthor(authorID int64) ([]Content, error) // ContentsList retrieves the specified Content items. The parent argument should be either nil to indicate that the // parent column should not be considered in the query, or a list of the parent IDs to which the returned items should belong. // The value of offset may never be negative, which is why its type is uint64. ContentsList(siteID int64, cType string, parents []int64, statuses []string, authorID int64, offset uint64) ([]Content, error) // CountContent says how many content pages/posts there are with the given parameters and how many such have no parent. // Optionally give a non-zero authorID to also filter by author. // The given statuses should not have any punctuation at all (should be already sanitized). CountContent(siteID int64, pType string, statuses []string, authorID int64) (countTotal uint16, countParentLevel uint32, err error) // ContentCountSlug returns the number of rows with the given site ID and slug. ContentCountSlug(siteID int64, slug string) (count int64, err error) }
type ContentInserter ¶
type ContentManager ¶
type ContentManager interface { ContentGetter ContentInserter ContentDeleter }
type DB ¶
type DB interface { Init(env map[string]string) error Ping() error BeginTx() (Transaction, error) Ops // Close closes the underlying representation of the database connection. Close() error // ErrIsDupKey says if the error reports a database error indicating that an insert would // cause a duplicate key error. ErrIsDupKey(e error) bool }
A DB is an abstract handle on a database connection implemented for a particular DBMS.
var Conn DB
Conn represents the connection to the main database.
This variable is initialized when the Init function in this package is called, and its Close method is called before the program exits.
type Media ¶
type Media struct { // A UUID encoded in base32 without padding. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // File extension, starting with a dot if set; optional but not null. Ext string `protobuf:"bytes,2,opt,name=ext,proto3" json:"ext,omitempty"` // Foreign key to a Site ID. Site int64 `protobuf:"varint,3,opt,name=site,proto3" json:"site,omitempty"` // A user-given name. Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` // HTML "alt" tag. Alt string `protobuf:"bytes,5,opt,name=alt,proto3" json:"alt,omitempty"` // A description. Desc string `protobuf:"bytes,6,opt,name=desc,proto3" json:"desc,omitempty"` // Time when the object was uploaded. Uploaded *time.Time `protobuf:"bytes,7,opt,name=uploaded,proto3" json:"uploaded,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A Media represents a static media item belonging to a website.
The fields Id, Ext, Site, and Name are required; the other strings default to empty strings and must not be null; the Uploaded time defaults to the current time in the database.
func (*Media) Descriptor ¶
func (*Media) GetUploaded ¶
func (*Media) ProtoMessage ¶
func (*Media) ProtoMessage()
func (*Media) XXX_DiscardUnknown ¶
func (m *Media) XXX_DiscardUnknown()
func (*Media) XXX_Marshal ¶
func (*Media) XXX_Unmarshal ¶
type Ops ¶
type Ops interface { SiteManager BlobManager ContentManager UserManager UserMetaManager OptionManager }
Ops includes all of the operations that may be performed on a database.
type Option ¶
type Option struct { // Site is a foreign key to a Site ID. Site int64 `protobuf:"varint,1,opt,name=site,proto3" json:"site,omitempty"` K string `protobuf:"bytes,2,opt,name=k,proto3" json:"k,omitempty"` V []byte `protobuf:"bytes,3,opt,name=v,proto3" json:"v,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
An Option is a key => value pair holding a small amount of data for a site, the primary key being the composite of the site ID and the value of K.
func (*Option) Descriptor ¶
func (*Option) ProtoMessage ¶
func (*Option) ProtoMessage()
func (*Option) XXX_DiscardUnknown ¶
func (m *Option) XXX_DiscardUnknown()
func (*Option) XXX_Marshal ¶
func (*Option) XXX_Unmarshal ¶
type OptionDeleter ¶
type OptionGetter ¶
type OptionGetter interface { // OptionByKey returns a site's option selected by its K. OptionByKey(site int64, k string) (*Option, error) // OptionsLikeKey returns options selected by their K being like k, as matched using the LIKE string // pattern matching feature in the database system. // // The syntax valid for the k string ultimately depends on the database implementation in use, but as // a general guideline the core application here should only use pattern strings that are supported in // the LIKE feature of all the major DBMSs, such as PostgreSQL (and CockroachDB) and MySQL. OptionsLikeKey(site int64, k string) ([]Option, error) // OptionsKeyIn returns a site's options selected by the Ks IN list. // The strings in the Ks slice must be valid UTF-8 strings. OptionsKeyIn(site int64, Ks []string) ([]Option, error) // OptionsKeyInMapped returns a map of the K-V pairs of a site's options selected by the Ks IN list. // This function always returns a non-nil map, though the map may be empty. // An error is not returned if there are no records retrieved. OptionsKeyInMapped(site int64, Ks []string) (map[string][]byte, error) // OptionsKeyInMappedStr returns a map of the K-V pairs of a site's options selected by the Ks In list, // with the V values converted to strings. // This function always returns a non-nil map, though the map may be empty. // An error is not returned if there are no records retrieved. OptionsKeyInMappedStr(site int64, Ks []string) (map[string]string, error) // OptionV returns the V of a site's option selected by key. OptionV(site int64, k string) ([]byte, error) }
type OptionInserter ¶
type OptionInserter interface { // OptionUpdate updates an Option or creates a new record in the database if necessary. // // The primary key is set by both the site ID and the value of K. OptionUpdate(site int64, k string, v []byte) (rowsAffected int64, err error) // OptionUpdateStr updates an Option or creates a new record in the database if necessary. OptionUpdateStr(site int64, k string, v string) (rowsAffected int64, err error) // OptionsUpdate updates Option records or creates new records in the database if necessary. // The strings passed in as keys in the map must be valid UTF-8 strings. // Returned is the number of rows affected. OptionsUpdate(site int64, opts map[string]string) (int64, error) }
type OptionManager ¶
type OptionManager interface { OptionGetter OptionInserter OptionDeleter }
type Site ¶
type Site struct { // Row ID in the table. Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // The domain (no slashes; possibly includes sub-domain). Domain string `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty"` // The name of the website. Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // The URL of the main logo file. Logo string `protobuf:"bytes,4,opt,name=logo,proto3" json:"logo,omitempty"` // The URL of the favicon file. Favicon string `protobuf:"bytes,5,opt,name=favicon,proto3" json:"favicon,omitempty"` // The primary language. Language string `protobuf:"bytes,6,opt,name=language,proto3" json:"language,omitempty"` // The status of the TLS on the domain: 0 = none, 1 = configuring, 2 = good Tls uint32 `protobuf:"varint,7,opt,name=tls,proto3" json:"tls,omitempty"` // Time of the last update. Updated *time.Time `protobuf:"bytes,8,opt,name=updated,proto3" json:"updated,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A Site is the basic settings of a site, except for the time when the site was created. Everything else that shapes a site is in either an Option or a Blob.
func (*Site) Descriptor ¶
func (*Site) GetFavicon ¶
func (*Site) GetLanguage ¶
func (*Site) GetUpdated ¶
func (*Site) ProtoMessage ¶
func (*Site) ProtoMessage()
func (*Site) XXX_DiscardUnknown ¶
func (m *Site) XXX_DiscardUnknown()
func (*Site) XXX_Unmarshal ¶
type SiteDeleter ¶
type SiteDeleter interface { }
type SiteGetter ¶
type SiteInserter ¶
type SiteInserter interface { // InsertSite inserts a Site into the sites table and create all needed tables for the site in a transaction. // The int64 returned is the ID of the new site (the inserted row). // The domain passed in must have already been validated as a real domain name. InsertSite(domain, name string) (int64, error) }
type SiteManager ¶
type SiteManager interface { SiteGetter SiteInserter SiteDeleter }
type SiteMessage ¶
type SiteMessage struct { // Row ID in the table. Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // SiteId is a foreign key to a Site ID. SiteId int64 `protobuf:"varint,2,opt,name=site_id,json=siteId,proto3" json:"site_id,omitempty"` // Role is the minimum role a user must have to be shown the message. Role string `protobuf:"bytes,3,opt,name=role,proto3" json:"role,omitempty"` // K is a key to identify the message. K string `protobuf:"bytes,4,opt,name=k,proto3" json:"k,omitempty"` Message string `protobuf:"bytes,5,opt,name=message,proto3" json:"message,omitempty"` // Time when the message was created. Created *time.Time `protobuf:"bytes,6,opt,name=created,proto3" json:"created,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A SiteMessage is a notification message for a site, to be shown to all users whose role on the site is at least Role.
func (*SiteMessage) Descriptor ¶
func (*SiteMessage) Descriptor() ([]byte, []int)
func (*SiteMessage) GetCreated ¶
func (m *SiteMessage) GetCreated() *time.Time
func (*SiteMessage) GetId ¶
func (m *SiteMessage) GetId() int64
func (*SiteMessage) GetK ¶
func (m *SiteMessage) GetK() string
func (*SiteMessage) GetMessage ¶
func (m *SiteMessage) GetMessage() string
func (*SiteMessage) GetRole ¶
func (m *SiteMessage) GetRole() string
func (*SiteMessage) GetSiteId ¶
func (m *SiteMessage) GetSiteId() int64
func (*SiteMessage) ProtoMessage ¶
func (*SiteMessage) ProtoMessage()
func (*SiteMessage) Reset ¶
func (m *SiteMessage) Reset()
func (*SiteMessage) String ¶
func (m *SiteMessage) String() string
func (*SiteMessage) XXX_DiscardUnknown ¶
func (m *SiteMessage) XXX_DiscardUnknown()
func (*SiteMessage) XXX_Marshal ¶
func (m *SiteMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SiteMessage) XXX_Merge ¶
func (m *SiteMessage) XXX_Merge(src proto.Message)
func (*SiteMessage) XXX_Size ¶
func (m *SiteMessage) XXX_Size() int
func (*SiteMessage) XXX_Unmarshal ¶
func (m *SiteMessage) XXX_Unmarshal(b []byte) error
type Transaction ¶
A Transaction is an initialized database transaction. Each transaction must end with a call to either Commit or Rollback.
A Transaction guarantees a serializable isolation level.
type User ¶
type User struct { // Row ID in the table. Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // Username. Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname,omitempty"` // Email address. Email string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"` // Password, already hashed. Pass []byte `protobuf:"bytes,4,opt,name=pass,proto3" json:"pass,omitempty"` // First name. Fname string `protobuf:"bytes,5,opt,name=fname,proto3" json:"fname,omitempty"` // Last name. Lname string `protobuf:"bytes,6,opt,name=lname,proto3" json:"lname,omitempty"` // The user's role in the site being accessed in the current request. Role string `protobuf:"bytes,7,opt,name=role,proto3" json:"role,omitempty"` // Time of the last update. Updated *time.Time `protobuf:"bytes,8,opt,name=updated,proto3" json:"updated,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A User contains all the basic info of registered a user.
func (*User) Descriptor ¶
func (*User) GetUpdated ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) XXX_DiscardUnknown ¶
func (m *User) XXX_DiscardUnknown()
func (*User) XXX_Unmarshal ¶
type UserDeleter ¶
type UserGetter ¶
type UserInserter ¶
type UserManager ¶
type UserManager interface { UserGetter UserInserter UserDeleter }
type UserMessage ¶
type UserMessage struct { // Row ID in the table. Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // UserId is a foreign key to a User ID. UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // K is a key to identify the message. K string `protobuf:"bytes,3,opt,name=k,proto3" json:"k,omitempty"` Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` // Time when the message was created. Created *time.Time `protobuf:"bytes,5,opt,name=created,proto3" json:"created,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A UserMessage is a notification message for a user.
func (*UserMessage) Descriptor ¶
func (*UserMessage) Descriptor() ([]byte, []int)
func (*UserMessage) GetCreated ¶
func (m *UserMessage) GetCreated() *time.Time
func (*UserMessage) GetId ¶
func (m *UserMessage) GetId() int64
func (*UserMessage) GetK ¶
func (m *UserMessage) GetK() string
func (*UserMessage) GetMessage ¶
func (m *UserMessage) GetMessage() string
func (*UserMessage) GetUserId ¶
func (m *UserMessage) GetUserId() int64
func (*UserMessage) ProtoMessage ¶
func (*UserMessage) ProtoMessage()
func (*UserMessage) Reset ¶
func (m *UserMessage) Reset()
func (*UserMessage) String ¶
func (m *UserMessage) String() string
func (*UserMessage) XXX_DiscardUnknown ¶
func (m *UserMessage) XXX_DiscardUnknown()
func (*UserMessage) XXX_Marshal ¶
func (m *UserMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*UserMessage) XXX_Merge ¶
func (m *UserMessage) XXX_Merge(src proto.Message)
func (*UserMessage) XXX_Size ¶
func (m *UserMessage) XXX_Size() int
func (*UserMessage) XXX_Unmarshal ¶
func (m *UserMessage) XXX_Unmarshal(b []byte) error
type UserMeta ¶
type UserMeta struct { // UserId is a foreign key to a User ID. UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` K string `protobuf:"bytes,2,opt,name=k,proto3" json:"k,omitempty"` V []byte `protobuf:"bytes,3,opt,name=v,proto3" json:"v,omitempty"` // Time of the last update. Updated *time.Time `protobuf:"bytes,4,opt,name=updated,proto3" json:"updated,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A UserMeta struct contains the key and value of a meta datum for a user (along with the timestamp of the last update of the row). The rows in the database table are primary-keyed by both the user ID and the K.
func (*UserMeta) Descriptor ¶
func (*UserMeta) GetUpdated ¶
func (*UserMeta) ProtoMessage ¶
func (*UserMeta) ProtoMessage()
func (*UserMeta) XXX_DiscardUnknown ¶
func (m *UserMeta) XXX_DiscardUnknown()
func (*UserMeta) XXX_Marshal ¶
func (*UserMeta) XXX_Unmarshal ¶
type UserMetaDeleter ¶
type UserMetaGetter ¶
type UserMetaGetter interface { UserMetaById(userID int64) ([]UserMeta, error) UserMetaByIdMapped(userID int64) (map[string][]byte, error) UserMetaByIdKey(userID int64, k string) (*UserMeta, error) UserMetaByIdLikeKey(userID int64, k string) ([]UserMeta, error) UserMetaV(userID int64, k string) (v []byte, err error) }
type UserMetaInserter ¶
type UserMetaManager ¶
type UserMetaManager interface { UserMetaGetter UserMetaInserter UserMetaDeleter }
type UserPasswordGetter ¶
Directories
¶
Path | Synopsis |
---|---|
Package cockroach contains the official implementation of the CockroachDB integration.
|
Package cockroach contains the official implementation of the CockroachDB integration. |
Package mysql contains the official implementation of the MySQL integration.
|
Package mysql contains the official implementation of the MySQL integration. |
Package postgres contains the official implementation of the PostgreSQL integration.
|
Package postgres contains the official implementation of the PostgreSQL integration. |