firemodel

package
v0.0.36 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestEnum_Strings = map[TestEnum]string{TestEnum_LEFT: "TestEnum_LEFT", TestEnum_RIGHT: "TestEnum_RIGHT", TestEnum_UP: "TestEnum_UP", TestEnum_DOWN: "TestEnum_DOWN"}
View Source
var TestEnum_Values = map[string]TestEnum{"TestEnum_LEFT": TestEnum_LEFT, "TestEnum_RIGHT": TestEnum_RIGHT, "TestEnum_UP": TestEnum_UP, "TestEnum_DOWN": TestEnum_DOWN}
View Source
var TestModelRegexNamedPath = regexp.MustCompile("^(?:projects/[^/]*/databases/[^/]*/documents/)?(?:/)?users/(?P<user_id>[a-zA-Z0-9]+)/test_models/(?P<test_model_id>[a-zA-Z0-9]+)$")

TestModelRegexNamedPath is a named regex that can be use to filter out firestore events of TestModel

View Source
var TestModelRegexPath = regexp.MustCompile("^(?:projects/[^/]*/databases/[^/]*/documents/)?(?:/)?users/([a-zA-Z0-9]+)/test_models/([a-zA-Z0-9]+)$")

TestModelRegexPath is a regex that can be use to filter out firestore events of TestModel

View Source
var TestTimestampsRegexNamedPath = regexp.MustCompile("^(?:projects/[^/]*/databases/[^/]*/documents/)?(?:/)?timestamps/(?P<test_timestamps_id>[a-zA-Z0-9]+)$")

TestTimestampsRegexNamedPath is a named regex that can be use to filter out firestore events of TestTimestamps

View Source
var TestTimestampsRegexPath = regexp.MustCompile("^(?:projects/[^/]*/databases/[^/]*/documents/)?(?:/)?timestamps/([a-zA-Z0-9]+)$")

TestTimestampsRegexPath is a regex that can be use to filter out firestore events of TestTimestamps

Functions

func TestModelPath

func TestModelPath(userId string, testModelId string) string

TestModelPath returns the path to a particular TestModel in Firestore.

func TestModelStructToPath added in v0.0.19

func TestModelStructToPath(path *TestModelPathStruct) string

TestModelStructToPath is a function that turns a PathStruct of TestModel into a firestore path

func TestTimestampsPath

func TestTimestampsPath(testTimestampsId string) string

TestTimestampsPath returns the path to a particular TestTimestamps in Firestore.

func TestTimestampsStructToPath added in v0.0.19

func TestTimestampsStructToPath(path *TestTimestampsPathStruct) string

TestTimestampsStructToPath is a function that turns a PathStruct of TestTimestamps into a firestore path

Types

type Client added in v0.0.21

type Client struct {
	Client         *firestore.Client
	TestModel      *clientTestModel
	TestTimestamps *clientTestTimestamps
}

func NewClient added in v0.0.21

func NewClient(client *firestore.Client) *Client

type Test added in v0.0.10

type Test struct {
	Direction TestEnum `firestore:"direction,omitempty"`
}

type TestEnum added in v0.0.10

type TestEnum string
const (
	TestEnum_LEFT  TestEnum = "LEFT"
	TestEnum_RIGHT TestEnum = "RIGHT"
	TestEnum_UP    TestEnum = "UP"
	TestEnum_DOWN  TestEnum = "DOWN"
)

func (TestEnum) String added in v0.0.16

func (e TestEnum) String() string

type TestModel

type TestModel struct {
	// The name.
	Name string `firestore:"name,omitempty"`
	// The age.
	Age int64 `firestore:"age"`
	// The number pi.
	Pi float64 `firestore:"pi"`
	// The birth date.
	Birthdate time.Time `firestore:"birthdate,omitempty"`
	// True if it is good.
	IsGood     bool                     `firestore:"isGood"`
	Data       []byte                   `firestore:"data,omitempty"`
	Friend     *firestore.DocumentRef   `firestore:"friend,omitempty"`
	Location   *latlng.LatLng           `firestore:"location,omitempty"`
	Colors     []string                 `firestore:"colors,omitempty"`
	Numbers    []int64                  `firestore:"numbers,omitempty"`
	Bools      []bool                   `firestore:"bools,omitempty"`
	Doubles    []float64                `firestore:"doubles,omitempty"`
	Directions []TestEnum               `firestore:"directions,omitempty"`
	Models     []*TestStruct            `firestore:"models,omitempty"`
	Models2    []*TestStruct            `firestore:"models2,omitempty"`
	Refs       []*firestore.DocumentRef `firestore:"refs,omitempty"`
	ModelRefs  []*firestore.DocumentRef `firestore:"modelRefs,omitempty"`
	Meta       map[string]interface{}   `firestore:"meta,omitempty"`
	MetaStrs   map[string]string        `firestore:"metaStrs,omitempty"`
	Direction  TestEnum                 `firestore:"direction,omitempty"`
	TestFile   *runtime.File            `firestore:"testFile,omitempty"`
	Url        runtime.URL              `firestore:"url,omitempty"`
	Nested     *TestStruct              `firestore:"nested,omitempty"`

	// Creation timestamp.
	CreatedAt time.Time `firestore:"createdAt"`
	// Update timestamp.
	UpdatedAt time.Time `firestore:"updatedAt"`
}

A Test is a test model.

Firestore document location: /users/{user_id}/test_models/{test_model_id}

type TestModelPathStruct added in v0.0.19

type TestModelPathStruct struct {
	UserId      string
	TestModelId string
}

TestModelPathStruct is a struct that contains parts of a path of TestModel

func TestModelPathToStruct added in v0.0.19

func TestModelPathToStruct(path string) *TestModelPathStruct

TestModelPathToStruct is a function that turns a firestore path into a PathStruct of TestModel

type TestModelWrapper added in v0.0.19

type TestModelWrapper struct {
	Data    *TestModel
	Path    *TestModelPathStruct
	PathStr string
	// contains filtered or unexported fields
}

TestModelWrapper is a struct wrapper that contains a reference to the firemodel instance and the path

func TestModelFromSnapshot added in v0.0.21

func TestModelFromSnapshot(snapshot *firestore.DocumentSnapshot) (*TestModelWrapper, error)

TestModelFromSnapshot is a function that will create an instance of the model from a document snapshot

func (*TestModelWrapper) Set added in v0.0.21

func (m *TestModelWrapper) Set(ctx context.Context) error

func (*TestModelWrapper) SetTx added in v0.0.31

type TestStruct added in v0.0.5

type TestStruct struct {
	Where    string   `firestore:"where,omitempty"`
	HowMuch  int64    `firestore:"howMuch"`
	SomeEnum TestEnum `firestore:"someEnum,omitempty"`
}

type TestTimestamps

type TestTimestamps struct {

	// Creation timestamp.
	CreatedAt time.Time `firestore:"createdAt"`
	// Update timestamp.
	UpdatedAt time.Time `firestore:"updatedAt"`
}

Firestore document location: /timestamps/{test_timestamps_id}

type TestTimestampsPathStruct added in v0.0.19

type TestTimestampsPathStruct struct {
	TestTimestampsId string
}

TestTimestampsPathStruct is a struct that contains parts of a path of TestTimestamps

func TestTimestampsPathToStruct added in v0.0.19

func TestTimestampsPathToStruct(path string) *TestTimestampsPathStruct

TestTimestampsPathToStruct is a function that turns a firestore path into a PathStruct of TestTimestamps

type TestTimestampsWrapper added in v0.0.19

type TestTimestampsWrapper struct {
	Data    *TestTimestamps
	Path    *TestTimestampsPathStruct
	PathStr string
	// contains filtered or unexported fields
}

TestTimestampsWrapper is a struct wrapper that contains a reference to the firemodel instance and the path

func TestTimestampsFromSnapshot added in v0.0.21

func TestTimestampsFromSnapshot(snapshot *firestore.DocumentSnapshot) (*TestTimestampsWrapper, error)

TestTimestampsFromSnapshot is a function that will create an instance of the model from a document snapshot

func (*TestTimestampsWrapper) Set added in v0.0.21

func (*TestTimestampsWrapper) SetTx added in v0.0.31

Jump to

Keyboard shortcuts

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