GithubHelp home page GithubHelp logo

linkedlist's Introduction

Linked List Implementation in Go

This repository contains a simple implementation of a linked list in Go. It supports basic operations such as insert, find, get, and remove. Each of these operations is accompanied by comprehensive unit tests to ensure the correctness and stability of the implementation.

Getting Started

Prerequisites

Ensure you have Go installed on your system. You can verify this by running go version in your command line. If Go is not installed, you can download and install it from the official Go website.

Running the Code

To run the main application which demonstrates some linked list operations, use the following command:

go run linkedList.go

Run Server on port 8080

Inset Value:

curl -X POST -H "Content-Type: application/json" -d '{"index": 0, "value": 10}' http://localhost:8080/v1/insert

Get a Value:

curl -X GET "http://localhost:8080/v1/get/1"

Remove Value:

curl -X GET "http://localhost:8080/v1/find/10"

Find Value:

curl -X DELETE "http://localhost:8080/v1/remove/1"

Items List:

curl -X GET "http://localhost:8080/v1/list"

Running All Tests

go test ./linkedlist/ -v

Run property-based test

go test ./linkedlist/ -v -run 'TestLinkedListPropertiesQuick'

Run unit tests

go test -run TestLinkedListInsert ./linkedlist/ -v

Running Specific Function Tests

go test -run TestLinkedListInsert ./linkedlist/ -v

go test -run TestLinkedListFind ./linkedlist/ -v

go test -run TestLinkedListFind ./linkedlist/ -v

go test -run TestLinkedListRemove ./linkedlist/ -v

Hurl tests

Run your app and then replace your port with the 8080 below and then run the following command

hurl hurl-tests/tests.hurl --test --variable host=localhost:8080

Api v2

We are using echo for creating the v2 of the apis

Inset Value:

curl -X POST -H "Content-Type: application/json" -d '{}' http://localhost:8080/v2/numbers/0/10

Get a Value By Index:

curl -X GET "http://localhost:8080/v2/numbers/index/1"

Find Value:

curl -X GET "http://localhost:8080/v2/numbers/value/10"

Remove Value:

curl -X DELETE "http://localhost:8080/v2/numbers/1"

Config

you can add configs in config/config.yaml file and then for hot reloading you can send a SIGHUP to the app after changing the config file

Start the Docker Compose Services

docker-compose up -d

Open your browser and go to http://localhost:3000 to access the Grafana web interface.

linkedlist's People

Contributors

alipourhabibi avatar iajrdev avatar pouriya avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.