repository

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileRepository

type FileRepository struct {
}

FileRepository implements a simple wrapper around golang's filesystem interface libraries. It should be registered by the driver on platforms where it is appropriate to do so.

This repository is suitable to handle the file:// scheme.

Since: 2.0

func NewFileRepository

func NewFileRepository() *FileRepository

NewFileRepository creates a new FileRepository instance. The caller needs to call repository.Register() with the result of this function.

Since: 2.0

func (*FileRepository) CanList

func (r *FileRepository) CanList(u fyne.URI) (bool, error)

CanList implements repository.ListableRepository.CanList()

Since: 2.0

func (*FileRepository) CanRead

func (r *FileRepository) CanRead(u fyne.URI) (bool, error)

CanRead implements repository.Repository.CanRead

Since: 2.0

func (*FileRepository) CanWrite

func (r *FileRepository) CanWrite(u fyne.URI) (bool, error)

CanWrite implements repository.WritableRepository.CanWrite

Since: 2.0

func (*FileRepository) Child

func (r *FileRepository) Child(u fyne.URI, component string) (fyne.URI, error)

Child implements repository.HierarchicalRepository.Child

Since: 2.0

func (*FileRepository) Copy

func (r *FileRepository) Copy(source, destination fyne.URI) error

Copy implements repository.CopyableRepository.Copy()

Since: 2.0

func (*FileRepository) CreateListable

func (r *FileRepository) CreateListable(u fyne.URI) error

CreateListable implements repository.ListableRepository.CreateListable.

func (*FileRepository) Delete

func (r *FileRepository) Delete(u fyne.URI) error

Delete implements repository.WritableRepository.Delete

Since: 2.0

func (*FileRepository) Destroy

func (r *FileRepository) Destroy(scheme string)

Destroy implements repository.Repository.Destroy

func (*FileRepository) Exists

func (r *FileRepository) Exists(u fyne.URI) (bool, error)

Exists implements repository.Repository.Exists

Since: 2.0

func (*FileRepository) List

func (r *FileRepository) List(u fyne.URI) ([]fyne.URI, error)

List implements repository.ListableRepository.List()

Since: 2.0

func (*FileRepository) Move

func (r *FileRepository) Move(source, destination fyne.URI) error

Move implements repository.MovableRepository.Move()

Since: 2.0

func (*FileRepository) Parent

func (r *FileRepository) Parent(u fyne.URI) (fyne.URI, error)

Parent implements repository.HierarchicalRepository.Parent

Since: 2.0

func (*FileRepository) Reader

func (r *FileRepository) Reader(u fyne.URI) (fyne.URIReadCloser, error)

Reader implements repository.Repository.Reader

Since: 2.0

func (*FileRepository) Writer

func (r *FileRepository) Writer(u fyne.URI) (fyne.URIWriteCloser, error)

Writer implements repository.WritableRepository.Writer

Since: 2.0

type HTTPRepository added in v2.1.0

type HTTPRepository struct{}

HTTPRepository implements a proxy for interacting with remote resources using golang's net/http library.

This repository is suitable to handle the http:// and https:// scheme.

Since: 2.1

func NewHTTPRepository added in v2.1.0

func NewHTTPRepository() *HTTPRepository

NewHTTPRepository creates a new HTTPRepository instance. The caller needs to call repository.Register() with the result of this function.

Since: 2.1

func (*HTTPRepository) CanRead added in v2.1.0

func (r *HTTPRepository) CanRead(u fyne.URI) (bool, error)

CanRead makes a HEAD HTTP request to analyse the headers received from the remote server. Any response status code apart from 2xx is considered to be invalid.

CanRead implements repository.Repository.CanRead

Since: 2.1

func (*HTTPRepository) Destroy added in v2.1.0

func (r *HTTPRepository) Destroy(string)

Destroy implements repository.Repository.Destroy

Sine: 2.1

func (*HTTPRepository) Exists added in v2.1.0

func (r *HTTPRepository) Exists(u fyne.URI) (bool, error)

Exists checks whether the the resource at u returns a non "404 NOT FOUND" response header.

The method is a part of the implementation for repository.Repository.Exists

Since: 2.1

func (*HTTPRepository) Reader added in v2.1.0

func (r *HTTPRepository) Reader(u fyne.URI) (fyne.URIReadCloser, error)

Reader provides a interface for reading the body of the response received from the request to u.

The method is a part of the implementation for repository.Repository.Exists

Since: 2.1

type InMemoryRepository

type InMemoryRepository struct {
	// Data is exposed to allow tests to directly insert their own data
	// without having to go through the API
	Data map[string][]byte
	// contains filtered or unexported fields
}

InMemoryRepository implements an in-memory version of the repository.Repository type. It is useful for writing test cases, and may also be of use as a template for people wanting to implement their own "virtual repository". In future, we may consider moving this into the public API.

Because of it's design, this repository has several quirks:

* The Parent() of a path that exists does not necessarily exist

  • Listing takes O(number of extant paths in the repository), rather than O(number of children of path being listed).

This repository is not designed to be particularly fast or robust, but rather to be simple and easy to read. If you need performance, look elsewhere.

Since: 2.0

func NewInMemoryRepository

func NewInMemoryRepository(scheme string) *InMemoryRepository

NewInMemoryRepository creates a new InMemoryRepository instance. It must be given the scheme it is registered for. The caller needs to call repository.Register() on the result of this function.

Since: 2.0

func (*InMemoryRepository) CanList

func (m *InMemoryRepository) CanList(u fyne.URI) (bool, error)

CanList implements repository.ListableRepository.CanList()

Since: 2.0

func (*InMemoryRepository) CanRead

func (m *InMemoryRepository) CanRead(u fyne.URI) (bool, error)

CanRead implements repository.Repository.CanRead

Since: 2.0

func (*InMemoryRepository) CanWrite

func (m *InMemoryRepository) CanWrite(u fyne.URI) (bool, error)

CanWrite implements repository.WritableRepository.CanWrite

Since: 2.0

func (*InMemoryRepository) Child

func (m *InMemoryRepository) Child(u fyne.URI, component string) (fyne.URI, error)

Child implements repository.HierarchicalRepository.Child

Since: 2.0

func (*InMemoryRepository) Copy

func (m *InMemoryRepository) Copy(source, destination fyne.URI) error

Copy implements repository.CopyableRepository.Copy()

Since: 2.0

func (*InMemoryRepository) CreateListable

func (m *InMemoryRepository) CreateListable(u fyne.URI) error

CreateListable impelements repository.ListableRepository.CreateListable.

Since: 2.0

func (*InMemoryRepository) Delete

func (m *InMemoryRepository) Delete(u fyne.URI) error

Delete implements repository.WritableRepository.Delete

Since: 2.0

func (*InMemoryRepository) Destroy

func (m *InMemoryRepository) Destroy(scheme string)

Destroy implements repository.Repository.Destroy

func (*InMemoryRepository) Exists

func (m *InMemoryRepository) Exists(u fyne.URI) (bool, error)

Exists implements repository.Repository.Exists

Since: 2.0

func (*InMemoryRepository) List

func (m *InMemoryRepository) List(u fyne.URI) ([]fyne.URI, error)

List implements repository.ListableRepository.List()

Since: 2.0

func (*InMemoryRepository) Move

func (m *InMemoryRepository) Move(source, destination fyne.URI) error

Move implements repository.MovableRepository.Move()

Since: 2.0

func (*InMemoryRepository) Parent

func (m *InMemoryRepository) Parent(u fyne.URI) (fyne.URI, error)

Parent implements repository.HierarchicalRepository.Parent

Since: 2.0

func (*InMemoryRepository) Reader

func (m *InMemoryRepository) Reader(u fyne.URI) (fyne.URIReadCloser, error)

Reader implements repository.Repository.Reader

Since: 2.0

func (*InMemoryRepository) Writer

func (m *InMemoryRepository) Writer(u fyne.URI) (fyne.URIWriteCloser, error)

Writer implements repository.WritableRepository.Writer

Since: 2.0

Jump to

Keyboard shortcuts

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